JSON
Scalar
json_exists()
Test whether a JSON document contains a path, including paths whose stored value is JSON null.
Reference: Haybarn WASM 2.0.0-rc12
Arguments & returns
4 overloadsjson_exists(json, path)
Scalar
Check whether a JSON path exists
Test whether a JSON document contains a path, including paths whose stored value is JSON null.
An existing path returns true and an absent path returns false. SQL NULL input produces SQL NULL.
Haybarn WASM 2.0.0-rc12 · In your browser
Guide example · Run to view results.
| present | absent | missing |
|---|---|---|
true | false | NULL |
Watch for: Existence does not mean a value is non-null. Use json_type() or extract the value when the distinction matters.
In other engines
PostgreSQLjsonb_exists()
SELECT JSONB_EXISTS('{"a": [1,2,3]}', 'a')
SELECT JSON_EXISTS('{"a": [1,2,3]}', '$.a')