MLE JavaScript Support for JSON

Supported conversions between JavaScript and the JSON data type.

Values of the SQL JSON type can be converted to and from JavaScript values. The type mapping between the SQL JSON type and JavaScript values is aligned with type mappings employed by the node-oracledb driver.

Note: For more information about node-oracledb and the JSON data type, see the node-oracledb documentation.

Values of the SQL JSON type are converted to JavaScript values as follows:

Mapping from JSON Attribute Types and Values to JavaScript Types and Values

JSON Attribute Type or Value JavaScript Type or Value
null null
false false
true true
NUMBER Number
VARCHAR2 String
RAW Uint8Array
CLOB String
BLOB UintArray
DATE Date
TIMESTAMP Date
INVERVAL YEAR TO MONTH OracleIntervalYearToMonth
INTERVAL DAY TO SECOND OracleIntervalDayToSecond
BINARY_DOUBLE Number
BINARY_FLOAT Number
Arrays Array
Objects A plain JavaScript Object

Values of a JavaScript type are converted to the SQL JSON type as follows:

Mapping from JavaScript Types and Values to JSON Attributes and Values

JavaScript Type or Value JSON Attribute Type or Value
null null
undefined null
string VARCHAR2
true true
false false
Uint8Array RAW
Number NUMBER
Date DATE
OracleNumber NUMBER
OracleDate DATE
OracleTimestamp TIMESTAMP
OracleTimestampTZ TIMESTAMP WITH TIME ZONE
OracleIntervalYearToMonth INVERVAL YEAR TO MONTH
OracleIntervalDayToSecond INTERVAL DAY TO SECOND
Array Array
Object Object