My code:
JSONObject data = {"result":{"a":[{"artist":"Aney","number:"1"},{"artist":"Aney","number:"2"}],"b":[{"artist":"Boney","number:"3"},{"artist":"Boney","number:"4"}], ....
JSONObject obj = new JSONObject(data.toString());
JSONArray tasks = obj.optJSONArray("result");
But tasks
returns null
.
I tried the below code but it did not work:
JSONObject data = {"result":{"a":[{"artist":"Money",...
JSONArray tasks = data.optJSONArray("result");
Update :
My main code is :
// get data from main url and reutnr array
JSONArray tasks = data.optJSONArray("result");
if(alert){
// get data from another url and return object
JSONObject data = {"result":{"a":[{"artist":"Money",...
tasks = data.optJSONArray("result");
}
// now i use tasks in my code
if(tasks.length() > 0){
....
}