-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deserialization of Custom Wrapper Class Fails in Jackson 2.18.1 Without Nested Object Structure #865
Comments
2.18.2 is out and has some fixes that could help |
I’ve just tested with Jackson 2.18.2, and the same issue persists. |
If this is Kotlin, then you should report this to the jackson-module-kotlin project. |
Moving to Kotlin module repo. |
I am fairly certain that the issue is with un-annotated 1-arg constructor of I am not 100% sure why heuristics details changed, aside from saying that the whole property introspection (including Creator method introspection, that is, constructor/factory method introspection) was completely rewritten to address problems with Records and mismatching of annotations. But given inherent difficulty in correctly guessing intent of 1-argument constructors, the usual way is to mark Constructor with
(or use which will force use of specific mode. |
Describe your Issue
When upgrading from Jackson
2.17.2
to2.18.1
, I encountered an issue with deserializing a custom wrapper class (ValidatedList) directly from an array in JSON. Previously, in2.17.2
, the deserialization worked as expected.Here is the code representation of my classes:
In Jackson
2.17.2
, the following JSON deserialized correctly:But in
2.18.1
i have a problem with deserialization:Error: Cannot deserialize value of type `example.ValidatedList<example.Record>` from Array value (token `JsonToken.START_ARRAY`) at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 3, column: 11] (through reference chain: example.Profile["list"])
To make the deserialization work in
2.18.1
, the JSON has to be structured with an additionalitems
key like this:Question
Is there a way to configure Jackson
2.18.1
to accept the original JSON format (without the nesteditems
key)? I would like to maintain compatibility with the original JSON format while using the newer version of Jackson.Any advice or configuration suggestions to address this would be greatly appreciated
The text was updated successfully, but these errors were encountered: