Skip to main content
Scalar function
A NULL top-level input returns SQL NULL; nested NULL values are emitted as JSON null.

Syntax

Scalar

Arguments

Returns

  • Type: STRING
  • NULL behavior: A NULL top-level input returns SQL NULL; nested NULL values are emitted as JSON null.

Properties

Usage notes

  • Takes exactly one STRUCT, ARRAY, or MAP argument. Other scalar inputs and additional format arguments are not supported.
  • Default date format is yyyy-MM-dd; default timestamp format is yyyy-MM-dd’T’HH:mm:ss[.SSS][XXX].
  • Nonfinite floating values are emitted as JSON null.
  • Deterministic: The same inputs and settings produce the same result.

Examples

Typical behavior

Serialize an array with a NULL element

Limitations

  • Custom date or timestamp format arguments are not supported.
  • BINARY and TIME fields or elements raise an error. The supported STRUCT form does not establish support for serializing a logical VARIANT value.
Last modified on October 15, 2026