JSON_MERGE

2023-10-24 09:23:03  Updated

Purpose

You can call this function to merge multiple JSON documents. It is a synonym for JSON_MERGE_PRESERVE().

Syntax

JSON_MERGE(json_doc, json_doc[, json_doc] ...)

Notes

json_doc specifies the JSON documents that you want to merge.

Examples

obclient> SELECT JSON_MERGE('[1, 2, 3]', '[true, false]', '{"a":100}');
+-------------------------------------------------------+
 JSON_MERGE('[1, 2, 3]', '[true, false]', '{"a":100}') 
+-------------------------------------------------------+
 [1, 2, 3, true, false, {"a": 100}]                    
+-------------------------------------------------------+
1 row in set

obclient> SELECT JSON_MERGE('{"1": 2}', '[true, false]', '{"a":100}');
+------------------------------------------------------+
 JSON_MERGE('{"1": 2}', '[true, false]', '{"a":100}') 
+------------------------------------------------------+
 [{"1": 2}, true, false, {"a": 100}]                  
+------------------------------------------------------+
1 row in set

obclient> SELECT JSON_MERGE('{"1": 2}',  '{"a":100}');
+--------------------------------------+
 JSON_MERGE('{"1": 2}',  '{"a":100}') 
+--------------------------------------+
 {"1": 2, "a": 100}                   
+--------------------------------------+
1 row in set

Contact Us