Annotation Interface JsonbProperty


Customizes serialization and/or deserialziaton of JSON property names.

By default, property names are serialized unchanged (identity transformation). This annotation overrides that default for the annotated program element.

Usage

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

  • field: used for both serialization and deserialization.
  • record component: used for both serialization and deserialization.
  • getter: used only for serialization.
  • setter: used only for deserialization.
  • record component accessor method: used only for serialization.
  • record virtual attribute method: used only for serialization.
  • parameter: used on a JsonbCreator annotated constructor or static factory method parameter only for deserialization.

It is possible to specify different custom names on the getter and setter of the same JavaBean property, in which case the getter name is used for serialization and the setter name is used for deserialization independently.

Since:
JSON Binding 1.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Deprecated.
    Please use the JsonbNillable annotation instead.
    Customized JSON property name for the annotated element.
  • Element Details

    • value

      String value
      Customized JSON property name for the annotated element.
      Returns:
      Customized property name.
      Default:
      ""
    • nillable

      @Deprecated(since="2.1") boolean nillable
      Deprecated.
      Please use the JsonbNillable annotation instead. This element will be removed in the future.
      Switches on/off serialization of null values.
      Returns:
      True if field with null value should be serialized as key/value pair into JSON with null value.
      Default:
      false