The BSON_TO_JSON function converts a string containing formatted BSON data to a character string containing the data formatted as JSON.
Specifies an expression that returns a binary string value. It must contain formatted BSON data.
If JSON-expression is a JSON object with a key name of SYSIBM_ROOT_ARRAY, the key will be removed and the result will be the key's value.
If JSON-expression contains duplicate keys, the duplicate keys are retained in the result JSON string.
The data type of the result is CLOB(2G) with a CCSID of 1208.
If the argument can be null, the result can be null; if the argument is null, the result is the null value.
If the outer JSON object's key is SYSIBM_ROOT_ARRAY, the key will be removed and the result will be the value of the key.
- Insert a value that contains data formatted as BSON into a column that holds JSON
INSERT INTO TABLE1 (JSON_COLUMN) VALUES (BSON_TO_JSON(:BSON_DATA));