Fixes to use JSONObject and JSONArray