- Overview
- Data types
- Commands
- Functions
- Overview
- Aggregate
- Conditional expression
- Conversion
- Date and time
- Numeric
- String
- Semi-structured data
On this page
parse_json
Interprets an input string as a JSON document, producing an ANY value.
You can use the parse_json function when you have input data in JSON format. This function can convert data from JSON format to a value of ANY type. You can then analyze or manipulate the data.
Syntax
parse_json( <expr> )
Arguments
<expr>
An expression of string type that holds valid JSON information.
Returns
Returns a value of type ANY that contains a JSON document.
If the input is NULL, the function returns NULL.
Examples
Parsing NULL
and 'null'
both return a NULL value:
SELECT parse_json(NULL), parse_json('null');
+------------------+--------------------+
| parse_json(NULL) | parse_json('null') |
+------------------+--------------------+
| NULL | NULL |
+------------------+--------------------+
Other regular calls:
SELECT parse_json('{"b":1,"a":2}');
+-----------------------------+
| parse_json('{"b":1,"a":2}') |
+-----------------------------+
| {"a":2,"b":1} |
+-----------------------------+