I am trying to display data from JSON array to ListView. But it gives me an exception:
org.json.JSONException: Value [{\"fine_id\":\"51771\",\"st
Do the following:
Change
JSONObject data = jsonObj.getJSONObject(json);
to
JSONArray data = jsonObj.getJSONArray(json);
json is an array, not an object. Thus you are getting an exception.
Edited:
for(int i=0; i<data.length(); i++)
{
JSONObject obj=data.getJSONObject(i);
String value1 = obj.getString(FINE_ID);
String value2 = obj.getString(WHATEVER YOU WANT);
System.out.println(value1);
System.out.println(value2);
}
P.S
[ represents JSON array node
{ represents JSON object node