Annotation Type JsonProperty
Names a field in the JSON form, and says how a body may spell it.
The default JSON key is the field name; value lets a field map to
snake_case or any other spelling without touching the Java identifier.
aliases are further names a body may use for the same member -- an old
spelling a client still sends -- and are only ever read: the value is
always written under value. required makes a body that leaves the
member out a refused body, naming the member; an explicit null is still
a value, so it is accepted (and refused for a primitive, which cannot hold it).
On a parameter of a JsonCreator constructor or factory it names the member
that argument is read from, since a compiled class does not keep its
parameter names.
The server's generated codecs read it too, so a class shared between an app and its backend has one JSON form on both sides.
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
-
aliases
-
required
boolean requiredWhether a body that leaves the member out is refused.- Default:
false
-