I am trying to deserialize a JSON array into a Java Collection using Jackson. This motivated by the answers to this question I asked last night Can I instantiate a superclass an
As often happens, writing out a question helps you see the solution. So I need to do two things.
Firstly I need to add the type information into the JSON - which is not what I really wanted to do, but I guess you need to provide that information somewhere.
And then I need to edit the annotation on QueryValue to be:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({
@Type(value = ResourceQueryValue.class, name = "ResourceQueryValue"),
@Type(value = NumericQueryValue.class, name= "NumericQueryValue")
})