Skip to main content
Analyzes and gets strings from the specified path (json_path) in a JSON string. If the format of json_string or json_path is wrong or if no matching value is found, this function will return NULL. Tip All of the JSON functions and operators are listed in the navigation and on the overview page Accelerate your queries with generated columns The alias is get_json_object.

Syntax

Parameters

  • json_str: the JSON string. Supported data type is VARCHAR.
  • json_path: the JSON path. Supported data type is VARCHAR. json_path starts with $ and uses . as the path separator. [ ] is used as the array subscripts which starts from 0. For example, $."my.key"[1] indicates to obtain the second value form element my.key.

Return value

Returns a value of the VARCHAR type. If no matching object is found, NULL is returned.

Examples

Example 1: Get the value whose key is k1

Example 2: Get the value whose key is a from the first element

Example 3: Get the second element in the array whose key is my.key

Example 4: Get the first element in the array whose path is k1.key -> k2

Example 5: Get all values whose key is k1 from the array

keyword

GET_JSON_STRING,GET,JSON,STRING