Serializer options
Options of the json.Serializer
class for controlling serialization
behavior.
Option | Description | Affects | Default | Example use |
---|---|---|---|---|
allowImplicitConversion |
This option modifies the behavior of JSON deserialization by allowing implicit
type conversions when the JSON property specifies one type, but the values suggest
another. Typically, json.serializer implements strict schema validation during
deserialization. If a JSON property is expected to be a certain type (for example, boolean), but the
provided values are of a different type (for example strings), a deserialization error should occur.
Important:
The option does not apply to simple-type |
Deserialization (JSON to BDL) | False (implicit conversion is not allowed) |
CALL json.Serializer.setOption("allowImplicitConversion",1) .
For an example, go to JSON to BDL deserialization option to allow implicit conversions |
allowNullAsDefault |
Allow NULL values to be accepted during deserialization when
the json_null="null" attribute is not explicitly specified. |
Deserialization (JSON to BDL) | False ( |
CALL json.Serializer.setOption("allowNullAsDefault",1) . For
examples, go to JSON to BDL deserialization options to allow nulls |
serializeNullAsDefault |
Allow NULL values to be accepted during serialization, even if
constraints are set (for example, JSONRequired defined or json_null="null" not defined). |
Serialization (BDL to JSON) | False ( |
CALL json.Serializer.setOption("serializeNullAsDefault",1). For
examples, go to BDL to JSON serialization options to allow nulls |
json_null="null"
|
Attribute required to deserialize JSON null values into BDL variables, or to enable serialization (BDL to JSON) of null values. | Both Serialization (BDL to JSON) and Deserialization (JSON to BDL) | Not set | For more information about managing null with the json_null attribute, go to
NULLs and empty structures. |