com.fasterxml.jackson.annotation

Annotation Type JsonPropertyOrder



  • @Target(value={ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD})
    @Retention(value=RUNTIME)
    public @interface JsonPropertyOrder
    Annotation that can be used to define ordering (possibly partial) to use when serializing object properties. Properties included in annotation declaration will be serialized first (in defined order), followed by any properties not included in the definition. Annotation definition will override any implicit orderings (such as guarantee that Creator-properties are serialized before non-creator properties)

    Examples:

      // 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
      @JsonPropertyOrder(alphabetic=true)
    

    This annotation may or may not have effect on deserialization: for basic JSON handling there is no effect, but for other supported data types (or structural conventions) there may be.

    NOTE: annotation is allowed for properties, starting with 2.4, mostly to support alphabetic ordering of Map entries.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element and Description
      boolean alphabetic
      Property that defines what to do regarding ordering of properties not explicitly included in annotation instance.
      String[] value
      Order in which properties of annotated object are to be serialized in.
    • Element Detail

      • value

        public abstract String[] value
        Order in which properties of annotated object are to be serialized in.
        Default:
        {}
      • alphabetic

        public abstract boolean alphabetic
        Property that defines what to do regarding ordering of properties not explicitly included in annotation instance. If set to true, they will be alphabetically ordered; if false, order is undefined (default setting)
        Default:
        false

Copyright © 2008–2017 FasterXML. All rights reserved.