JSON_EXTRACT_KEYS
Returns an array of strings containing the keys at the nesting level indicated by the specified <json_pointer_expression>
. If keys do not exist, returns NULL
.
Syntax
JSON_EXTRACT_KEYS(<json>, '<json_pointer_expression>')
Parameter | Type | Description |
---|---|---|
<json> | TEXT | The JSON document from which keys are to be extracted. |
<json_pointer_expression> | Literal string | A JSON pointer to the location of the array in the JSON. For more information, see JSON pointer expression syntax. |
Example
For the JSON document indicated by <json_common_example>
below, see JSON common example. The Returns result is based on this common example.
SELECT
JSON_EXTRACT_KEYS(<json_common_example>, 'value')
FROM
RAW_JSON
Returns: ["dyid","uid","keywords","tagIdToHits","events"]