I am getting and error response from server in android studio. how do I extract the values.
Json:
{
"error": {
"phone": [
"The phone field is required."
]
}
}
Code:
try {
JSONArray arr = new JSONArray(response);
for (int i = 0; i < arr.length(); i++) {
JSONObject mJsonObject = arr.getJSONObject(i);
Log.d("OutPut", mJsonObject.getString("phone"));
}
} catch (JSONException e) {
e.printStackTrace();
}