JSON Scalar

json_extract()

Select a value from a JSON document by path while keeping the result as JSON, including quotes around JSON strings.

Reference: Haybarn WASM 2.0.0-rc12

Arguments & returns

6 overloads

json_extract(json, index)

Scalar
Overload link jsonindex Returns
#01 JSONBIGINT JSON
#02 VARCHARBIGINT JSON

json_extract(json, path)

Scalar
Overload link jsonpath Returns
#03 JSONVARCHAR JSON
#04 JSONVARCHAR[] JSON[]
#05 VARCHARVARCHAR JSON
#06 VARCHARVARCHAR[] JSON[]

Extract JSON values by path

Select a value from a JSON document by path while keeping the result as JSON, including quotes around JSON strings.

A missing path produces SQL NULL. A JSON null value is a JSON value and can be distinguished with json_type().

Extract JSON values by path
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Guide example · Run to view results.

Expected result
first_jsonmissing
"apple"NULL

Watch for: JSON arrays use zero-based positions. Use json_extract_string() when you need unquoted text for display or comparison.