I have a json as follows:
"customer": {
"personal": {
"name": “jim johnson”,
“miscellaneous”: {
“active”: “true”,
“addons”: {
"location": “us”
},
“customer_id”: “1234”
}
},
“source”: “main db”
}
I can create an simple POJO mapping everything one to one but what I would like is the following:
I would like to have an object such as follows:
class Customer {
Personal personal;
String source;
}
class Personal {
String name;
String customer_id;
String miscellaneous; // <—— This is the problem
// JsonObject miscellaneous;
}
How can I deserialize the json and have the miscellaneous kept as a string of raw json string? Or even have it as a raw json element?