Skip to content

[REQ][java][jackson] Add JsonPropertyOrder annotation for Spring Boot generator #23933

Open

Description

@petervandenbroek

Jackson 3 now by default sorts properties properties alphabetically instead of following the logical order of the generated classes.
This seems to be only fixable by adding the JsonPropertyOrder annotation (disabling the alphabetical sort in Jackson does nothing).

In the pull request related to issue 3629, this was done for the JAX-RS server, but not for any other Java generators.

Activity

  1. thesauravpoddar commented on Jun 3, 2026

    @thesauravpoddar

    I would like to work on this.

  2. petervandenbroek commented on Jun 3, 2026

    @petervandenbroek
    Author

    @thesauravpoddar I'm working on a PR myself as well, but please go ahead if you want to do it :)

  3. thesauravpoddar commented on Jun 3, 2026

    @thesauravpoddar

    I looked into similar issues, issue 3629, issue 3441 and what i understood is that i have to modify the mustache template of JavaSpring for POJO, basically POJO.mustache, adding @JsonPropertyOrder and in the same file I also need to add JSON_PROPERTY_ constant declarations per field inside {{#jackson}} … {{/jackson}} as these constants are what the @JsonPropertyOrder annotation references. And also have to add the proper import for com.fasterxml.jackson.annotation.JsonPropertyOrder in importMapping as discussed in issue 3441. Then have to generate test snapshot if that is working or not. Please correct me if I am wrong on any of these

  4. thesauravpoddar commented on Jun 5, 2026

    @thesauravpoddar

    I opened a pull request can you please check that?

  5. petervandenbroek commented on Jul 3, 2026

    @petervandenbroek
    Author

    @thesauravpoddar where is this pull request, can you link it here?

  6. thesauravpoddar commented on Jul 3, 2026

    @thesauravpoddar

    #23957

    This is the pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions