My code retrieves the JSONObject results, but sometimes the value I do not start with 1, and I have this error:
org.json.JSONException: No value for 1
My code is:
JSONObject obj = new JSONObject(result); for(int i=1;i<=14;i++) { JSONArray arr = obj.getJSONArray(""+i); extraction(arr, i); }
I want to check before retrieving if the object code (i) exists or not. How can i do this?
source share