def parse_json(response): if response.startswith('['): json_arr = JSONArray(response) return [ json_arr.getJSONObject(i) for i in xrange(0, json_arr.length()) ] return JSONObject(response)
def parse_json(response): if response.startswith('['): json_arr = JSONArray(response) return [json_arr.getJSONObject(i) for i in xrange(0, json_arr.length())] return JSONObject(response)