Scalar function
NULL value/path, missing paths, out-of-range indices and syntactically invalid nonempty paths produce SQL NULL.
Syntax
Scalar
Arguments
Returns
- Type: VARIANT
- NULL behavior: NULL value/path, missing paths, out-of-range indices and syntactically invalid nonempty paths produce SQL NULL.
- Shape: A VARIANT scalar, object, or array. This is a VARIANT value rather than an ordinary SQL STRUCT.
- Ordering: Array element order is preserved; object-key order is not a SQL ordering guarantee.
Properties
Usage notes
- An empty path string extracts the whole value. Outside Snowflake a leading JSONPath $ is stripped; in Snowflake $ is a literal field prefix.
- The path can be a constant STRING or a STRING expression that varies by row.
- Deterministic: The same inputs and settings produce the same result.
Examples
Display depends on the SQL dialect
- Non-Snowflake context; Snowflake uses path a[1].
- The table shows the logical VARIANT value. Your SQL client may display it differently.
Read a nested field
Limitations
- Use the path syntax shown here. Do not assume support for every JSONPath wildcard or negative-index form.
- Argument type errors or corrupt VARIANT encoding can raise errors.
Last modified on October 15, 2026