I am having a JSON in which I have all the data as key-value pair. But my POJO is with nested class. How can I map the single level JSON into the nested class objects?
My JSON looks like this:
{
"prototype" : {
"name": "Deepak"
"departmentId": "10"
"departmentName": "IT"
"address": "Bangalore"
"state": "Karnataka"
}
}
And my POJO looks like this:
class Prototype{
String name;
Department dept;
Address address;
}
class Department {
Integer departmentId;
String departmentName;
}
class Address {
String address;
String state;
}
I tried using ObjectMaper but it only maps the name, other fields are not getting mapped. Does anyone knows how to achieve this