I have a nested JSON which looks like this.
{
"eventId" : "12345",
"eventName" : "carnival",
"object": {
"objectId" : "5678",
"objectFiles" : [{"fileName":"text.txt", "fileContent":"This is a test file."},
{"fileName":"text2.txt", "fileContent":"This is a test2 file."}]
}
}
Here I have to fetch the eventFiles key, replace the fileContent value with Base64Encoded String and place it back to the same eventFiles attribute. I know that I can use Jackson Mapper to convert it into Map and iterate them one by one, untill I find eventFiles key, then fetch and replace the value and store it back again. I tried to convert it as a Map using TypeReference<String, Object> or even TypeReference<Map<String, Map<String, Object>>> but the problem here is the nested JSON where ultimately it would become Map inside of a Map inside of a Map which would become pretty complex to handle.
Is there any other simpler way to accomplish this? Any suggestions would be really helpful. Thanks in advance.