this is my json response
{
"status": true,
"code": 200,
"message": "Success",
"data": {
"id": "14"
}
}
how to read this values
this is my json response
{
"status": true,
"code": 200,
"message": "Success",
"data": {
"id": "14"
}
}
how to read this values
You can use the help of Google's GSON library built for exact your pupose.
YourPojoClass model = new Gson().fromJson(jsonResponse, YourPojoClass.class);
Convert your json to PojoModel by using jsonschema2pojo.org
You can do it like this:
Create a JSONObject:
JSONObject jObject = new JSONObject(result);
To get a specific boolean
String aJsonString = jObject.getBoolean("status");
To get a specific String
String aJsonString = jObject.getString("message");
To get a specific Integer
int aJsonInteger = jObject.getInt("code");