Reputation: 3062
I've seen there are quite a few questions around, but I think I am missing a detail that I couldn't find out.
The String I am getting as a response is included in the following error:
12-28 10:25:14.402: W/System.err(2133): org.json.JSONException: Value
{"status":"ok","userTier":"developer","total":1722082,"startIndex":1,"pageSize":5,"currentPage":1,"pages":344417,"orderBy":"newest",
"results":[{"webTitle":"AirAsia flight loses contact with air traffic control between Indonesia and Singapore","webPublicationDate":"2014-12-28T09:06:55Z","sectionName":"World news","sectionId":"world","id":"world\/live\/2014\/dec\/28\/airasia-flight-loses-contact-with-air-traffic-control-on-route-from-indonesia-to-singapore","webUrl":"
... at response of type org.json.JSONObject cannot be converted to JSONArray
My code is
JSONObject jObject = new JSONObject(result);// result is the sting response presented above
JSONArray jArray = jObject.getJSONArray("response");
Upvotes: 0
Views: 128
Reputation: 709
The only JSONArray I see is the results key. You have to use the results key or you need the getJSONObject()-Method, as gio mentioned above.
Upvotes: 1
Reputation: 5020
response
key is JSONObject, you need to use getJSONObject
instead current method.
Upvotes: 1