Syntax
Parameters
Return Type
TEXT
- If the input is
NULL, the function returnsNULL. - The function always produces a valid JSON string for non-null inputs.
Type Conversions
The following table shows how Firebolt data types are converted to JSON:Behavior
- Struct conversion: Struct field names become JSON object keys. If a struct has unnamed fields, they are automatically named
f1,f2,f3, etc. - Nested structures: Nested structs become nested JSON objects, and arrays become JSON arrays.
- NULL handling: NULL input returns NULL. NULL fields within structs become JSON null values.
- Escaping: The function uses official json escaping that includes forward slashes (
/becomes\/).
Examples
The following example converts a simple struct to JSON:Rows: 1Execution time: 8.89ms
Rows: 1Execution time: 9.15ms
Rows: 1Execution time: 5.43ms
Rows: 1Execution time: 6.32ms
Rows: 1Execution time: 15.93ms
Rows: 1Execution time: 5.01ms
Rows: 1Execution time: 6.48ms