Posted on

Jackson ObjectMapper – specify serialization order of object properties

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

// 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)
Leave a Reply

Your email address will not be published. Required fields are marked *