JenuRudan JenuRudan - 10 months ago 28
JSON Question

Unable to parse to JSONARRAY

I get JSON response in my android application in which it contains an array which i parse to JSON in my code, it can't parse and the JSON looks fine


JSONArray A=response.getJSONArray("Favs");

Server Response



org.json.JSONException: Value [{"ID":1,"UserID":1,"LocName":"A7a","Lat":5.0,"Lng":5.0}] at Favs of type java.lang.String cannot be converted to JSONArray


The value of "Favs" is a string. Because it is wrapped with quotations ""

Look carefully:


If it is a JSON Array it should look like this:


with no quotations outside the brackets and no slash notations before those quotations inside too.