29.53 WRITE Procedure Signature 17

This procedure writes parts of a parsed APEX_JSON.t_values table as an object member attribute.

Syntax

APEX_JSON.WRITE (
    p_name             IN VARCHAR2,
    p_values           IN t_values,
    p_path             IN VARCHAR2 DEFAULT '.',
    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_write_null       IN BOOLEAN  DEFAULT FALSE ); 

Parameters

Table 29-67 WRITE Procedure Parameters

Parameter Description
p_name The attribute name.
p_values The parsed JSON members.
p_path The index into p_values.
p[0-4] Each %N in p_path will be replaced by pN and every i-th %s or %d is replaced by p[i-1].
p_write_null If true, write NULL values. If false (the default), do not write NULLs.

Example

This example parses a JSON string and writes parts of it as an object member.

DECLARE
  j apex_json.t_values;
BEGIN
  apex_json.parse(j, '{ "foo": 3, "bar": { "x": 1, "y": 2 }}');
  apex_json.open_object; -- {
  apex_json.write('parsed-bar',j,'bar');-- "parsed-bar":{ "x":1 ,"y":2 }
  apex_json.close_object; -- }
END;