I am getting following JSON string that I need to parse:
response => {
"error":false,
"uid":39,
"user":{
"name":"my username",
"email":"solinpromey@gmail.com",
"created_at":"2019-05-15 13:22:19",
"updated_at":null,
"imagen":null,
"nombre":null,
"apellidos":null,
"nivel_usuario":null,
"id_usuario":39,
"unique_id":null,
"verified":null,
"cel_verificado":null,
"tel":"123456789",
"code_cel":null
}
}
I need to get the values for the fields inside key user.
I am trying as follows, but not working:
String errorMsg = jObj.getString("error_msg");
Here I am getting an exception:
W/System.err: org.json.JSONException: No value for error_msg
and consequently, the following lines are not executed:
JSONObject jObj = new JSONObject(response);
JSONObject user = jObj.getJSONObject("user");
String email = user.getString("email");
Log.d("RESPUESTA", "RESPUESTA email" + email);