I have a string like this
"{
"scanReference": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"document": {
"status": "data",
"data": {
"firstName": "FULL NAME",
"info": "{\"city\":\"CITY\",\"issueDate\":\"2019-01-01\"}"
},
"country": "USA"
}
}"
I have created class (simple POJO) to convert this to java object and using GSON. I am using the below code to convert to java object.
(gson.fromJson(response, MyClass.class));
But I am receiving the below error when converting , it because "info" is a string not json.
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING
The code works as expected when I made "info" a json and tested it, but it is string here.
Can anyone help me to solve this problem?
PS: Thank you for help.