I have the following different JSONs
{
"item": [
{
"Retailer_Relation": {...},
"Retailer_Relation": {...},
"Retailer_Relation": {...}
}
]
}
and
{
"item": [
{
"Retailer": {...},
"Retailer": {...},
"Retailer": {...}
}
]
}
And the following class into which I deserialize the JSONs. This obviously only works for the second of the JSONs. However, I would like the JSON containing Retailer_Relation objects to work with the RetailerHolder pojo.
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RetailerHolder {
@JsonProperty("item")
private List<Retailer> item = new ArrayList<Retailer>();
public RetailerHolder() {
}
public List<Retailer> getItem() {
return item;
}
public void setItem(List<Retailer> item) {
this.item = item;
}
}
Is there a way to let Jackson know I also want Retailer_Relation to be deserialized into Retailer pojos?