Change JSONArray list = new JSONArray(Jo_result.getString("result"));
To JSONObject list = new JSONObject(Jo_result.getString("result"));
Your string is contained between {}
which makes it an object.
Keep in mind this
{}
= Json Object
[]
= Json Array
UPDATE
When you do this
JSONObject resultsObject = list.getJSONObject(i);
it’s expecting another object within the main object, for example :
{ // <-- main object
i : { <-- object failing
// ...
}
}
That’s what is the code expecting, where i is from the loop, but that doesn’t exist and besides that, the key must be a string, for example
{ // <-- main object
string : {
// ...
}
}
So, what I recommend you : remove the for loop since you don’t need it anymore and call your variables within the json like this list.getString("data_id")
since it’s the list
which contains your json object.
Hope it helps.
2
solved Android java type org.json.JSONObject cannot be converted to JSONArray