33.13 GET_COUNT Function
This function returns the number of array elements or object members.
Syntax
APEX_JSON.GET_COUNT (
    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 NUMBER;Parameters
Table 33-10 GET_COUNT Function Parameters
| Parameter | Description | 
|---|---|
| 
                               
  | 
                           
                               Index into   | 
                        
| 
                               
  | 
                           
                               Each %N in   | 
                        
| 
                               
  | 
                           
                               Parsed JSON members. The default is   | 
                        
Returns/Raised Errors
Table 33-11 GET_COUNT Function Returns and Raised Errors
| Return | Description | 
|---|---|
| 
                               
  | 
                           
                               The number of array elements or object members or null if the array or object could not be found  | 
                        
| 
                               
  | 
                           
                               Raises this error if   | 
                        
Example
This example parses a JSON string and prints the number of 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_count(p_path=>'.',p_values=>j)); -- 2 (foo and bar) 
    dbms_output.put_line(apex_json.get_count(p_path=>'bar',p_values=>j)); -- 4 
END; Parent topic: APEX_JSON