TRY_FROM_JSON
Overview
Parses a JSON string into a specified structured type (STRUCT, ARRAY, MAP, etc.). When parsing fails, it does not throw an error — instead it fills the result with NULL values and includes an error message. This makes it suitable for handling JSON data with uncertain formatting.
Difference from FROM_JSON: FROM_JSON throws an error on parse failure; TRY_FROM_JSON returns a result with an _error_msg field on failure.
Syntax
Parameters
<json_str>: STRING type. The JSON string to parse.<type_str>: STRING type. The target type description, such as'STRUCT<a:INT>'or'ARRAY<STRING>'.
Examples
Related Documentation
- FROM_JSON — version that throws an error on parse failure
- PARSE_JSON
