GET_MEMBERS Function

This function returns the table of OBJECT_MEMBERS names for an object.

Syntax

APEX_JSON.GET_MEMBERS (
    p_path             IN VARCHAR2,
    p0                 IN VARCHAR2 DEFAULT NULL,
    p1                 IN VARCHAR2 DEFAULT NULL,
    p2                 IN VARCHAR2 DEFAULT NULL,
    p3                 IN VARCHAR2 DEFAULT NULL,
    p4                 IN VARCHAR2 DEFAULT NULL,
    p_values           IN t_values DEFAULT g_values )
RETURN APEX_T_VARCHAR2;

Parameters

Table 20-11 GET_MEMBERS Function Parameters

Parameter Description

p_path

Index into p_values.

p[0-4]

Each %N in p_path is replaced by pN and every i-th %s or %d is replaced by the p[i-1].

p_values

Parsed JSON members. The default is g_values.

Returns/Raised Errors

Table 20-12 GET_MEMBERS Function Returns and Raised Errors

Return Description

OBJECT_MEMBERS

The OBJECT_MEMBERS of the object or null if the object could not be found.

VALUE_ERROR

Raises this error if p_values(p_path) is not an array or object.

Example

This example parses a JSON string and prints members at positions.

DECLARE 
    j apex_json.t_values; 
BEGIN 
    apex_json.parse(j, '{ "foo": 3, "bar": [1, 2, 3, 4] }'); 
    dbms_output.put_line(apex_json.get_members(p_path=>'.',p_values=>j)(1)); -- foo
    dbms_output.put_line(apex_json.get_members(p_path=>'.',p_values=>j)(2)); -- bar 
END;