JSON Values
JSON_VALUE
Parses JSON elements like an array, string, number, boolean, null which are not enclosed in a JSON object. This is perfectly valid and allowed by JSON Grammar).
output type | quantifier | configuration |
---|---|---|
variant (default) or explicitly selected conversion type | none | charset = character set name enclosed in single or double quotes (for example locale = string specifying IETF BCP 47 language tag enclosed in single or double quotes (see the list here). The default locale is English. typed = Boolean value, allowing to control JSON_VALUE output type: "false" sets the output to variant type, "true" sets output directly to explicitly selected conversion type. Effective only when used with the explicit conversion. strict = Boolean value. "false" allows parsing arrays not following JSON specification. Unquoted JSON names and string values consisting of one word can be parsed. Default is "true". See parsing_json_nstrict. maxlen = numeric value representing the maximum byte size of an array. Allows parsing large JSON arrays (exceeding default size of 128000 bytes). |
Example
Here we have two JSON values in separate lines: a number and a string.
33
"::1"
The number on line 1 is parsed automatically. The string on line 2 is explicitly converted to ipaddr:
JSON_VALUE{}:auto EOL JSON_VALUE{IPADDR}:ip
Here's the result (double-click on the resultset row to see the details):
name | value | type |
---|---|---|
auto | 33 | VARIABLE<LONG |
ip | ::1 | IPADDR |