get_json_object

This function is used to parse the JSON object in a specified JSON path. The function will return NULL if the JSON object is invalid.

Syntax

get_json_object(string <json>, string <path>)

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

json

Yes

STRING

Standard JSON object, in the {Key:Value, Key:Value,...} format.

path

Yes

STRING

Path of the object in JSON format, which starts with $. The meanings of characters are as follows:

  • $ indicates the root node.
  • . indicates a subnode.
  • [] indicates the index of an array, which starts from 0.
  • * indicates the wildcard for []. The entire array is returned. * does not support escape.

Return Values

The return value is of the STRING type.

  • If the value of json is empty or in invalid JSON format, NULL is returned.
  • If the value of json is valid and path is specified, the corresponding string is returned.

Example Code