@JsonbAnnotation
@Retention(RUNTIME)
@Target({ANNOTATION_TYPE,METHOD,FIELD,PARAMETER,RECORD_COMPONENT})
public @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
JsonbCreatorannotated 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
-
Element Details
-
value
String valueCustomized JSON property name for the annotated element.- Returns:
- Customized property name.
- Default:
- ""
-
nillable
Deprecated.Please use theJsonbNillableannotation 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
-
JsonbNillableannotation instead.