I have a JSON response coming from an API that is calling Elastic Search. The following is a sample snippet.
{
"fielda" : "something",
"hits" : {
"total" : "100",
"type" : "/some/type"
"dynamicAttributes":{
"somevalue1" : "somevalue",
"somevalue2" : "somevalue2"
}
}
}
The JSON subtree underneath the dynamicAttributes can be different with each result. I am trying to marshal that into an object based on the type field that comes in. There will be an established mapping between that value and a class somewhere in a map. It looks like Jackson maps the results into a LinkedHashMap if the type is not resolved. I'm looking to use a Custom Deserializer. Is this the best strategy for this? Or is there something simpler that I'm missing.