Closed sschepens closed 6 years ago
First of all this problem should be reported against jackson-databind
, as this package only defines annotations but does not contain code to use them (databind does).
Second: it would be good to know which version of Jackson you are using.
Other than this, combination of @JsonValue
and polymorphic types is problematic from implementation perspective -- in this case I am not sure how deserialization could work (for example), there not being matching @JsonCreator
. I can't say for sure whether handling for serialization is correct or not without investigating it, but I would strongly recommend trying to solve your use case without use of @JsonValue
.
@cowtowncoder
I'm gonna reopen this against jackson-databind
.
I forgot to add constructors with @JsonCreator
, but yes, adding those constructors makes deserialization work.
How can I avoid using @JsonValue
, I seem to need to have those container classes, but serialize it as and internal property.
I'm trying to serialize the following structure. Classes:
Test case:
I would expect this test to print
But instead it outputs
It seems to be ignoring wrapping because i'm using
@JsonValue
, what's strange is that deserializing the content I expected works. Am I doing this wrong? Is there other way I can achieve this?