Skip to content
Harald Pehl edited this page Oct 29, 2012 · 1 revision

Ordering in Piriti

Order

Piriti processes all annotated fields in random order. If you depend on a specific order, you can use the order attribute. Suppose you have the following model: public class User { @Json(order = 0) String username; @Json(order = 2) String firstname; @Json(order = 1) String surname; @Json int age; @Json boolean valid; }

When reading / writing JSON data the fields are proceesed in this order

  1. username
  2. surname
  3. firstname
  4. age or valid
  5. age or valid (order is not specified)
Clone this wiki locally