CHECK_JSON (Lakehouse v1)
Checks the validity of a JSON document.
If the input string is a valid JSON document or a NULL, the output is NULL.
If the input cannot be translated to a valid JSON value, the output string contains the error message.
Analyze Syntax
Section titled “Analyze Syntax”func.check_json(<expr>)Analyze Examples
Section titled “Analyze Examples”func.check_json('[1,2,3]');┌────────────────────────────┐│ func.check_json('[1,2,3]') │├────────────────────────────┤│ NULL │└────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”CHECK_JSON( <expr> )Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<expr> | An expression of string type |
Return Type
Section titled “Return Type”String
SQL Examples
Section titled “SQL Examples”SELECT check_json('[1,2,3]');┌───────────────────────┐│ check_json('[1,2,3]') │├───────────────────────┤│ NULL │└───────────────────────┘
SELECT check_json('{"key":"val"}');┌─────────────────────────────┐│ check_json('{"key":"val"}') │├─────────────────────────────┤│ NULL │└─────────────────────────────┘
SELECT check_json('{"key":');┌──────────────────────────────────────────────┐│ check_json('{"key":') │├──────────────────────────────────────────────┤│ EOF while parsing a value at line 1 column 7 │└──────────────────────────────────────────────┘