JSON_EXTRACT_PATH_TEXT
functionsupportedCore SQL functionsParses the first argument as a JSON string and returns the value of the element pointed to by the path in the second argument. This is equivalent to TO_VARCHAR(GET_PATH(PARSE_JSON(JSON), PATH))
Syntax
JSON_EXTRACT_PATH_TEXT( <column_identifier> , '<path_name>' )
Parameters
| Name | Required | Description |
|---|---|---|
column_identifier | required | The name of the column with the data that you want to extract. |
path_name | required | A string that contains the path to the element that you want to extract. |
Returns
The data type of the returned value is VARCHAR.
Usage notes
- The function returns NULL if the path name does not correspond to any element.
- The path name syntax is standard JavaScript notation; it consists of a concatenation of field names (identifiers) preceded by periods (e.g. .) and index operators (e.g. [<index>]): The first field name does not require the leading period to be specified.
- The index values in the index operators can be non-negative integers (for arrays) or single or double-quoted string literals (for object fields).
- For more details, see Querying Semi-structured Data.
- To maintain syntactic consistency, the path notation also supports SQL-style double-quoted identifiers, and use of : as path separators.