I’m using Android’s org.json.JSONObject class, and it’s worked wonderfully so far. But now I’m parsing a slightly different object, and it’s giving me a JSONException: no value for name. But the name is definitely there.
I even logged a toString() of the JSONObject, and it’s there.. Here it is:
07-28 17:29:47.281: D/asdf(1639): {"status":"OK","file":{"id":32707990,"icon":"removedforstackoverflow","screenshot":"removedforstackoverflow","name":"Testname123","created_at":"2012-05-23T22:42:55","is_mp4_available":null,"content_type":"application\/x-iso9660-image","is_shared":false,"size":155271168,"parent_id":0}}
Why is it saying it’s not there, when it definitely is? Am I missing something?
You’re probably trying to get the name from the root object. But name is a field of the sub-object stored under the
filename.