Skip to content

Add a JSON.Feature.WRITE_RECORD_FIELDS_IN_DECLARATION_ORDER for retaining Serialization order of Java Records (instead of alphabetic) #171

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

Closed
cowtowncoder opened this issue Oct 22, 2024 · 0 comments
Labels

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Oct 22, 2024

As of 2.18, Java Records are fully supported. Order of property serialization is the same as for POJOs, alphabetic.
But since Records have a "natural" property ordering -- by declaration order -- it would make sense to support that.
However, with 2.18 being released and defaulting to alphabetic ordering, we'll need a feature to allow opt-in change to declaration order, leaving default to alphabetic.

Being new feature (and JSON.Feature), this needs to go in 2.19; cannot add in a patch.

@cowtowncoder cowtowncoder changed the title Add a JSON.Feature for retaining Serialization order of Java Records (instead of alphabetic) Add a JSON.Feature.WRITE_RECORD_FIELDS_IN_DECLARATION_ORDER for retaining Serialization order of Java Records (instead of alphabetic) Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant