I have a JSON format like this
{“response”:{“status”:true,”result”:”user_exists”}}
Now i am trying to retrieve the Status value to do some logic
JSONObject jData = new JSONObject(data);
JSONArray response = jData.getJSONArray("response");
But i am getting the following error
org.json.JSONException: Value {“result”:”user_exists”,”status”:true}
at response of type org.json.JSONObject cannot be converted to
JSONArray
how to retrieve an Object from inside and Object ?
you are trying to retreive the status attribut from a
JSONArraybut , you don’t have anyJSONArrayin your Code , (JSONArrayis surrounded by[], andJSONObjectis surrounded by{}) ,So to retreive the status value , try this :