How can we map the java object to json? Java object will have a map and some other string properties. What I want is that when we convert the java object to json that map keys should be as root key not nested key.
Sample Java Object :
class Demo {
String name;
String designation;
Map<String,Object> attribute;
}
Now if Map is having values like below :
Map<String,Object> attribute = new HashMap<>();
attribute.put("score",190);
attribute.put("status","allowed");
Output should be like below:
{
"name":"jack",
"designation":"Tester",
"score":190,
"status":"allowed"
}