parse_json
parse_json(value: string, [options(...)]?) -> variant
Parse the argument value as a JSON string.
The object or array that comes out is typically put into a column using make_col.
parse_json accepts one option, allow_duplicate_keys (see below).
Options
| Option | Type | Meaning |
|---|---|---|
| allow_duplicate_keys | bool | Applies to JSON inputs with duplicate keys. If true, the last value of the duplicate key is used. If false, the function returns null. Default is false. |
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
Make a new column, of type variant, containing the contents of field payload parsed as JSON.
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 the JSON portion of the string log into new field StringPayload, then parse it as JSON.
Make a new column containing the specified string parsed as JSON. By default, because parse_json does not allow duplicate keys,
the column would contain null. However, since allow_duplicate_keys is enabled, the column will instead contain {"k1": "v2"},
which is obtained from the last value that is assigned to the key in the source JSON.