JSON
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Parses a string and interprets it as a JSON value, validating that the string is well-formed JSON.
You can also parse a string into JSON with a cast.
<string>: The string to parse as JSON. The string must be a valid JSON document.
FORMAT JSON: Accepted for SQL-standard compatibility. It has no effect on the result.
Returns a json value. Use the result to embed pre-formatted JSON into json_array or json_object, or wherever a json value is expected.
- The input string is validated as JSON. Invalid input is rejected with an
invalid JSON documenterror. - The cast forms
<string>::jsonandCAST(<string> AS json)perform the same validation as thejsonconstructor. - Use
TRY_CAST(<string> AS json)if you want to suppress validation errors. - The
WITH UNIQUE KEYSoption from the SQL-standard, which would reject objects with duplicate keys, isn’t supported. - Parsing preserves the document’s textual content, including insignificant whitespace.
Interpret a string as a JSON value.
Returns {"a":1}.
A cast from a string performs the same validation.
Returns [].
Use the constructor to embed an existing document without escaping it.
Returns {"a":1,"b":{"nested":true}}.
Malformed input raises an error.
Raises an invalid JSON document error.
- JSON Type
[JSON_ARRAY](./json-array.md)- Build a JSON array from a list of values.[JSON_OBJECT](./json-object.md)- Build a JSON object from key-value pairs.[JSON_SCALAR](./json-scalar.md)- Convert a scalar value to JSON.- Type Conversions - Type casting and coercion.