29.51 WRITE Procedure Signature 15

This procedure writes an array attribute of type sys.xmltype. The procedure uses a XSL transformation to generate JSON. To determine the JSON type of values, it uses the following rules:
  • If the value is empty, it generates a NULL value.

  • If upper(value) is TRUE, it generates a boolean true value.

  • If upper(value) is FALSE, it generates a boolean false value.

  • If the XPath number function returns true, it emits the value as is. Otherwise, it enquotes the value (that is, treats it as a JSON string).

Syntax

APEX_JSON.WRITE (
    p_name         IN VARCHAR2,
    p_value        IN sys.xmltype,
    p_write_null   IN BOOLEAN  DEFAULT FALSE );

Parameters

Table 29-65 WRITE Procedure Parameters

Parameter Description
p_name The attribute name.
p_value The value to be written. The XML is converted to JSON
p_write_null If true, write NULL values. If false (the default), do not write NULLs.

Example

See example for WRITE Procedure Signature 14.