0

Is there any way to impose certain order of fields for FasterXML JSON serialization? For example, I need myObject.date go exactly first, then myObject.amount exactly after that, then myObject.itemsCollection, etc.

If there is no existing method to do it, then how can I implement it? I think about using some custom annotations for the object fields but I don't know where to start, what to do next...

user3791111
  • 1,469
  • 1
  • 15
  • 20

1 Answers1

0

The solution is very simple. Just use this annotation in the class to be serialized: http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonPropertyOrder.html

user3791111
  • 1,469
  • 1
  • 15
  • 20