I inherited some legacy Java code which passes me a parameter of type Object.
Inside that I find some List<Map<String, Object>>
or a Map<String, List<Object>>
(Object here could be the same structures)
I know the drawbacks of that, no need for explantation here. The above is stuff I can not change, no way here to generate POJO's in this case.
The data originates from some JSON like this example:
{
"accounting" : [
{ "firstName" : "John",
"lastName" : "Doe",
"age" : 23 },
{ "firstName" : "Mary",
"lastName" : "Smith",
"age" : 32,
"address" : {
"Street": "Dorfstrasse 23",
"city": "something"
}
}
],
"sales" : [
{ "firstName" : "Sally",
"lastName" : "Green",
"age" : 27 },
{ "firstName" : "Jim",
"lastName" : "Galley",
"age" : 41 }
]
}
Is there a convenient way to manipulate the java object structure like adding
address2 : {
"uvw": "123"
"xyz": "0815"
}
To the path accounting[1].address
without manual implementing this structure with JsonNode, iteration the JSON array etc.
At the end I want that changes in the Java Object, not as JSON string