I can read json's return in the format
[{"celular":"123456","_id":"1"}]
The code that works with json above is this:
public static void MakeJsonArrayReq() {
JsonArrayRequest jreq = new JsonArrayRequest(url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
for (int i = 0; i < response.length(); i++) {
try {
JSONObject jo = response.getJSONObject(i);
int _id = jo.getInt("_id");
String celular = jo.getString("celular");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
MyApplication.getInstance().addToReqQueue(jreq, "jreq");
}
I can not read json in the format:
{"carro":[{"celular":"123456","_id":"1"}]}
How can I adapt the MakeJsonArrayReq () method to read the json return above?