parse_json¶
Description¶
Parse the argument value as a JSON string.
The object or array that comes out is typically put into a column using make_col.
Return type¶
variant
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
parse_json(value)
| Argument | Type | Optional | Repeatable | Restrictions | 
|---|---|---|---|---|
| value | string | no | no | none | 
Examples¶
make_col json:parse_json(string(payload))
Make a new column, of type variant, containing the contents of field payload parsed as JSON.
make_col json:object(parse_json('{ "k1": "v1", "k2": [ "one", "two" ], "k3": { "key 4": ["five"] } }'))
Make a new column containing the specified string parsed as JSON. The result is coerced to object to ensure it has the desired type.
extract_regex log, /JSON payload: (?P<StringPayload>{.*})/
make_col payload:parse_json(StringPayload)
Extract the JSON portion of the string log into new field StringPayload, then parse it as JSON.
Aliases¶
parsejson (deprecated)