> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/special-functions/json-functions/json_merge.md).

# JSON\_MERGE

## Syntax

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

## Description

Merges the given JSON documents.

Returns the merged result, or `NULL` if any argument is `NULL`.

An error occurs if any of the arguments are not valid JSON documents.

{% hint style="warning" %}
`JSON_MERGE` is deprecated. [JSON\_MERGE\_PATCH](/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_patch.md) is an RFC 7396-compliant replacement, and [JSON\_MERGE\_PRESERVE](/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_preserve.md) is a synonym.
{% endhint %}

## Example

```sql
SET @json1 = '[1, 2]';
SET @json2 = '[3, 4]';

SELECT JSON_MERGE(@json1,@json2);
+---------------------------+
| JSON_MERGE(@json1,@json2) |
+---------------------------+
| [1, 2, 3, 4]              |
+---------------------------+
```

## See Also

* [JSON\_MERGE\_PATCH](/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_patch.md)
* [JSON\_MERGE\_PRESERVE](/docs/server/reference/sql-functions/special-functions/json-functions/json_merge_preserve.md)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
