I would like to know if it is possible to customize the deserialization of json depending the field name, for example
{
id: "abc123",
field1: {...}
other: {
field1: {....}
}
}
I the previous json, I would like to have a custom deserializer for the fields named "field1", in any level in the json.
The reason: We have our data persisted as JSON, and we have a REST service that returns such data, but before return it, the service must inject extra information in the "field1" attribute.
The types are very dynamic, so we cannot define a Java class to map the json to use annotations.
An first approach was to deserialize to Map.class and then use JsonPath to search the $..field1 pattern, but this process is expensive for bigger objects.
I appreciate any help.
Thanks,
Edwin Miguel