JSON
Scalar
json_extract_string()
Read a JSON field as VARCHAR without JSON string quotes, ready for text filtering, display, or a subsequent type conversion.
Reference: Haybarn WASM 2.0.0-rc12
Arguments & returns
6 overloadsjson_extract_string(json, index)
Scalar
json_extract_string(json, path)
Scalar
Extract JSON fields as text
Read a JSON field as VARCHAR without JSON string quotes, ready for text filtering, display, or a subsequent type conversion.
A missing path or a JSON null at the path produces SQL NULL.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide example · Run to view results.
| name | price | missing |
|---|---|---|
apple | 12 | NULL |
Watch for: The result is text even when the JSON value is numeric. Cast it before arithmetic, and use TRY_CAST if malformed values should become NULL.
In a query
Find the value inside the document.
Extract a JSON field directly as text, ready to use in the rest of your query.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide recipe · Run to view results.