0

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

SteveFerg
3,6107 gold badges22 silver badges33 bronze badges
asked Jul 5, 2015 at 6:45
4
  • JavaScript Object Notation Commented Jul 5, 2015 at 14:11
  • I know it's full form. I meant what is the json in json.getJSONArray("37358058"); ? What does it contain? Commented Jul 5, 2015 at 14:21
  • oh. lol sorry um it pulls the json data from url. Here is the code. 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 Commented Jul 5, 2015 at 14:39
  • I cant seem to find the edit button for my last post but I think I've found the issue. Its with the url being HTTPS instead of HTTP. I got the Json and put it on my localhost webserver and tried from there and it works perfectly. This only concludes that HTTPS is the problem now :3 Commented Jul 5, 2015 at 15:19

1 Answer 1

1

To get division you have to do this

JSONArray entriesArray=c.getJSONArray("entries");
JSONObject entries=entriesArray.getJSONObject(0);
String division =entries.getString("divsion");
answered Jul 5, 2015 at 6:57
Sign up to request clarification or add additional context in comments.

1 Comment

Oh alright thanks. But I still am getting the No Value Error which is stopping everything else to go through like the tier + division :3.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.