so I'm trying to make this android widget which is related to league of legends. So this is the Json
{"37358058": [
{
"queue": "RANKED_SOLO_5x5",
"name": "Akali's Assassins",
"entries": [{
"leaguePoints": 0,
"isFreshBlood": false,
"isHotStreak": false,
"division": "IV",
"isInactive": false,
"isVeteran": true,
"losses": 136,
"playerOrTeamName": "Audition",
"playerOrTeamId": "37358058",
"wins": 154
}],
"tier": "PLATINUM"
}
]}
This is my current code from which I'm trying to pull the tier and the division from.
JSONArray summoner = null;
summoner = json.getJSONArray("37358058");
JSONObject c = summoner.getJSONObject(0);
String tier = c.getString("tier");
String division = c.getJSONObject("entries").getString("division");
`
The error I'm receiving is
No Value for 37358058
I can't seem to figure it out since its clearly populated.
Hope thats enough information. Thanks
1 Answer 1
To get division you have to do this
JSONArray entriesArray=c.getJSONArray("entries");
JSONObject entries=entriesArray.getJSONObject(0);
String division =entries.getString("divsion");
jsoninjson.getJSONArray("37358058");? What does it contain?JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONFromUrl(url);I have confirmed the url is correct so that shouldnt be the issue and the JSONParser class I've tried with other json file and it seems to work correctly with another url. The only thing I can think of that might make a difference is https instead of http. Does that make a difference? Thanks