Posted on Leave a comment

Jackson ObjectMapper – specify serialization order of object properties

https://stackoverflow.com/questions/27577701/jackson-objectmapper-specify-serialization-order-of-object-properties

[code]
// ensure that "id" and "name" are output before other properties
@JsonPropertyOrder({ "id", "name" })
// order any properties that don’t have explicit setting using alphabetic order
<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>@JsonPropertyOrder(alphabetic=true)
[/code]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.