Android JSON fetching - No value for (value) eventhough the value exists -
I have a valid json link, and I want to get data from it.
This is mine code to get the data:
try {JSONObject topicsObject = new JSONObject (getTopicsJSON); JSONArray theme = themeobject.gatejsnare ("topic"); For (int i = 0; i & lt; topics.length (); i ++) {supertrryranoptic stt = new supertraneropic (); JSONObject sub_topic = topics.getJSONObject (i); JSONObject theme = sub_topic.getJSONObject ("theme"); ...}
On the last line of the code, I get an error saying that org.json.JSONException: There is no value for the subject.
The following screenshots show that this is not correct, as I have received the log-ed JSON, and you can clearly see that there is a topic "topic" there: < / P>
First log of full Jason reaction The first part presents, and the second subject is the subject matter itself. Here is the second screenshot of the JSON format taken from your browser:
You can see that the "topics" and "meta" objects are at the same level of hierarchy. I will bring the "meta" object with no problem, using the same code I will use to bring 'topics', but for some reason, "subject" is not used.
Here I have the code to successfully use the "Meta" object:
JSONObject meta = sub-testic .getJSONObject ("meta");
What could be the reason for this? Is there something really clear that I remember?
Comments
Post a Comment