serializeNullAsDefault

Allow NULL values during serialization even when constraints are set, such as when JSONRequired is defined or when json_null="null" is not defined.

Syntax

The value parameter uses the BDL boolean: set to 1 to allow NULL values even when constraints such as JSONRequired apply, or set to 0 to disallow them (default).

serializeNullAsDefault is an optional option.

Usage

Use this option when you want NULL values to be accepted during serialization even if constraints are defined, such as JSONRequired, or when json_null="null" is not specified.

By default, NULL values are rejected during serialization if they violate constraints like JSONRequired. Enabling this option makes the behavior more permissive by allowing NULL values to pass through even when constraints are present.

Affects

Serialization (BDL to JSON)

Example

To allow NULL values during serialization when constraints are applied:


CALL json.Serializer.setOption("serializeNullAsDefault", 1)

For more examples, go to Serializing JSON nulls with serializeNullAsDefault.