json.Serializer options

Options for controlling serialization and deserialization behavior, set using the json.Serializer class.

Global options

Important:

These options apply to all JSON write paths and affect both json.Serializer and json.JSONWriter. They do not work with util.JSON; to configure equivalent serialization modes for util.JSON, use util.JSON.setDatetimeSerializationMode and util.JSON.setIntervalSerializationMode.

Table 1. Global options
Option Description Values
datetimeSerializationMode = value
Controls the JSON output format for DATETIME values during serialization.
  • "FGL": Genero default format (default)
  • "RFC3339/UTC": RFC 3339, normalized to UTC
  • "RFC3339/TZO": RFC 3339, with the local time zone offset
intervalSerializationMode = value
Controls the JSON output format for INTERVAL values during serialization.
  • "FGL": Genero default format (default)
  • "ISO8601": ISO 8601 duration format

Serializer-specific options

Important:

These options are supported only by json.Serializer and do not work with json.JSONWriter or util.JSON.

Table 2. Serializer-specific options
Option Description Values
allowImplicitConversion = value
Allow implicit type conversions during JSON deserialization when the JSON property specifies one type, but the values suggest another.
  • "1": enable
  • "0": disable (default)
allowNullAsDefault = value
Allow NULL values to be accepted during deserialization when the json_null="null" attribute is not explicitly specified.
  • "1": enable
  • "0": disable (default)
serializeNullAsDefault = value
Allow NULL values during serialization even when constraints are set, such as when JSONRequired is defined or when json_null="null" is not defined.
  • "1": enable
  • "0": disable (default)