an API returns the following JSON:
"objectA":{
"type":"typeA",
"value":{
"propertyA":{
"propertyAA":"3000",
"propertyAB":3
},
"propertyB":10
}
}
While "type" can be a wide range of classes and the "value" field contains the properties of that object. Is there an out of the box / annotation based solution provided by Jackson to solve this?
Before the last update by the API provider, the API was returning:
"objectA":{"type":"typeA","propertyA":{"propertyAA":"3000","propertyAB":3},"propertyB":10}
Which I was able to parse using:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({ @Type(value = TypeA.class, name = "typeA"),
[...]
As stated above, I am wondering if there is a Jackson configuration that allows to configure both, the field containing the type and the field which contains the actual object.
Thank you very much and best regards!