I have a json string:
{
"id":123,
"name":"",
"details":{}
}
I want to parse to this object:
class Student {
int id;
String name;
String details;
}
This is the error that I get:
java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx.xxx/xxx.xxx.MainActivity}: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT
The reason I want details as string not as a JsonObject because I'm using Realm DB object and persist that to the database. How can I tell Gson I want the details
as string.