Annotation Interface JsonbPropertyOrder


@JsonbAnnotation @Retention(RUNTIME) @Target({ANNOTATION_TYPE,TYPE}) public @interface JsonbPropertyOrder

Customizes the order in which properties are serialized for the annotated type.

By default, properties are serialized in lexicographical order. This annotation overrides that default and any order specified by PropertyOrderStrategy for the annotated type.

Usage

The @JsonbPropertyOrder annotation can be used with the following program elements:

  • class: ordering applies to all serializable fields and JavaBean properties.
  • record: ordering applies to all serializable record components and record virtual attributes.

Partial ordering

A partial ordering may be specified by listing only a subset of properties in value(). Properties listed in the annotation are serialized first, in the declared order. Any remaining properties not listed are serialized afterward in an unspecified order.

Property name resolution

Names provided in value() must correspond to the original property names as defined in the class or record, before any renaming customization (such as JsonbProperty or a PropertyNamingStrategy) is applied.

Since:
JSON Binding 1.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The order in which properties are serialized.
  • Element Details

    • value

      String[] value
      The order in which properties are serialized. Names must correspond to the original property or record component names as defined in the type, before any renaming customization is applied.
      Returns:
      Array of property names defining the serialization order.