I have a json like -
{
"type" : "employee",
"details" : {
"name" : "ABC",
"age" : 12,
"sex" : "male"
}
}
And a Java Class like -
public class Person {
String name;
String sex;
String type;
int age;
----getters and setters
}
I was wondering is there a ways to directly map the attributes of the details
object to the person class like details.name
to Person.name
.
I know this can be achieved with custom deserializers, but I was hoping to avoid it. May be some annotations that GSON or Jackson provides.