I have a JSON like
{
"age" : "35",
"otherdetails":{
"address" : "xyx",
"pincode" : "978897"
}
}
I have a base class to covert JSON TO JAVA
class Base
{
int age;
OtherDetails otherdetails;
}
also i have an interface for otherdetails and a class implementing the interface
interface OtherDetails
class AddressDetails extends OtherDetails
{
String address;
String pincode;
}
How can i use gson or jackson to convert the json so that it picksup AddressDetails class when converting thee otherdetails attribute?