Product types are disambiguated by a {"key":"value",...}
.
Product types are disambiguated by a {"key":"value",...}
. Of
course, this will fail if the product type has a field with the
same name as the key. The default key is the word "type" which
is a keyword in Scala so unlikely to collide with too many case
classes.
This variant is most common in JSON serialisation schemes and well supported by other frameworks.
Sometimes the wire format needs to match an existing format and
JsNull
behaviour needs to be customised.
Sometimes the wire format needs to match an existing format and
JsNull
behaviour needs to be customised. This allows null
behaviour to be defined at the product level. Field level control
is only possible with a user-defined RootJsonFormat
.
Product types are disambiguated by an extra JSON map layer containing a single key which is the name of the type of product contained in the value.
Product types are disambiguated by an extra JSON map layer
containing a single key which is the name of the type of product
contained in the value. e.g. {"MyType":{...}}
This variant may be more appropriate for non-polymorphic schemas such as MongoDB and Mongoose (consider using the above format on your endpoints, and this format when persisting).
All values serialising to JsNull
will be included in the wire format.
All values serialising to JsNull
will be included in the wire format. Ambiguous.
Same as AlwaysJsNull when serialising, with missing values treated as optional upon deserialisation.
Same as AlwaysJsNull when serialising, with missing values treated as optional upon deserialisation. Ambiguous.
Option values of None
are omitted, but Some
values of JsNull
are retained.
Option values of None
are omitted, but Some
values of JsNull
are retained. Default.
No values serialising to JsNull
will be included in the wire format.
No values serialising to JsNull
will be included in the wire format. Ambiguous.
Use the case class default value provided for the field when available.
Use the case class default value provided for the field when available. Ambiguous.