JSON_MERGE

2024-03-05 01:54:27  Updated

Purpose

JSON_MERGE() merges multiple JSON documents. It is a synonym for JSON_MERGE_PRESERVE().

Syntax

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

Description

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