If my property name has dot in json as shown in below, payment_details.type
and if I want to retrieve Json value using Gson
, how and what I will have to do.
{
"statusCode": 422,
"error": "Unprocessable Entity",
"message": "Bad data received",
"err_data": {
"payment_details.type": {
"location": "body",
"param": "payment_details.type",
"msg": "Must be either etransfer or cheque"
}
}
}
Currently I am doing this..
new Gson().fromJson(response.asString(), MyApiResponse.class).getErr_data().getPayment_details_type().getMsg();
It doesn't work for me.. I can't retrieve "msg" value from above json.