Parse Json Object With Multiple Levels Android
I know this has been asked many times before, I have read through dozens of questions and answers but for some reason I can't get my code to work so please don't close this questio
Solution 1:
items
is an array of objects... so, items.getJSONObject(9)
is returning the 10-th item which is an object that hold an attribute name "id"...
In other to get the Id, you will need something like this:
JSONObject jObj;
JSONObject tracks;
JSONArray items;
String id;
jObj = newJSONObject(json); // json is the JSON string
tracks = (JSONObject) jObj.get("tracks");
items = (JSONArray) tracks.get("items");
id = items.getJSONObject(9).getString("id");
Post a Comment for "Parse Json Object With Multiple Levels Android"