-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support for serializing Java Records #94
Comments
Correct: jackson-jr has no support for records at this point. I agree it'd be absolutely great to support them: possibly as a separate extension as that would allow code to use JDK 17 level (without core jackson-jr having to). |
note: changed title to reflect that first we'll be getting support for serializing (writing Records as JSON): deserialization would be later development. |
Implemented as per #130; needs to be enabled with
to be included in 2.17.0 release |
Hi,
Is there any ongoing work on this part ? Thanks |
@bmaggi I am not working on this: contributions would probably be needed for progress. Note was not meant to indicate any specific plans but rather that for now, only serialization support has been added. |
@cowtowncoder Thanks for the clarification. |
Note: support for Java Record deserialization with jackson-jr was added via #148 -- to be include in 2.18.0. /cc @bmaggi EDIT: had to revert initial deserialization support -- does not really work, except if all fields were included in exactly right order: Reordered or missing fields fail spectacularly, and implementation did not account for either. |
I tested it on my project and it seems to works perfectly. Thanks |
@bmaggi Alas, even if deserialization worked in "everything exactly right" case, it had fundamental problem of blindly assuming fields are included in exact order. So I had to revert the PR and as of now, support for Record deser does not exist. |
Indeed, my use case was using fields in exact order. |
@bmaggi Yeah it is not an unusual case as Jackson-jr (and Jackson) would be default serialize exactly that way. That's part of why I missed the obvious-in-hindsight problem. |
Hey all, I did not find any explicit claim that Java Records were supported so I decided to give it a shot. It seems to me that they are not, given the following snippet:
results in:
Perhaps I'm missing something that'd make this work, but if not I thought it'd be a good wish list addition 🙂
The text was updated successfully, but these errors were encountered: