Hi everyone,
I'd post a question on stack overflow without any success. My problem is
fully exposed here
<https://stackoverflow.com/questions/47523439/jackson-identity-info-not-wrapped-in-object-when-stored-in-collection>
.
In few words, i am not able to deserialize a collection of polymorphic
object. The source of the problem comes from interface annotations:
@JsonTypeInfo(use=Id.NAME, include=As.WRAPPER_OBJECT)
@JsonSubTypes({
@Type(value = Lion.class, name = "LION")
})
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class,
property=IAnimal.NAME)
I have type info for polymorphism and identity info for multiple
serialization of the same object. When stored in a collection, the
deserializer complain with identity references which are not wrapped in
object (as required with type info). Here is the exception i've got:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected
token (VALUE_STRING), expected START_OBJECT: need JSON Object to contain
As.WRAPPER_OBJECT type information for class
core.configuration.jackson.utilclass.dummy.IAnimal at [Source: (File);
line: 1, column: 40] (through reference chain:
core.configuration.jackson.utilclass.dummy.Cage["animals"]-
and here is the JSON of the animals collection made of IAnimal in my
exemple:
{"animals":[{"LION":{"NAME":"michel"}},"michel"]}
Thx for the help.
Kevin
--
You received this message because you are subscribed to the Google Groups
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.