Skip to main content
Converts a Map or Struct value into a JSON string. If the input value is NULL, NULL is returned. Tip All of the JSON functions and operators are listed in the navigation and on the overview page Accelerate your queries with generated columns If you want to cast values of other data types, see cast. This function is supported from v3.1 onwards.

Syntax

Parameters

any_value: the Map or Struct expression you want to convert. If the input value is invalid, an error is returned. The value in each key-value pair of the Map or Struct value is nullable. See the last example. GEOGRAPHY and GEOMETRY are unsupported anywhere inside the input, including typed NULLs. Use ST_AsText on the geo values before building the Map or Struct to include their WKT in JSON.

Return value

Returns a JSON value.

Examples

See also