MySQL JSON Merge
mysql_json_mergeMerge two JSON documents in memory using patch (RFC 7396) or preserve (array merge) mode.
Instructions
Merge two JSON documents using JSON_MERGE_PATCH or JSON_MERGE_PRESERVE.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc1 | No | Alias for json1 | |
| doc2 | No | Alias for json2 | |
| mode | No | Merge mode: patch (RFC 7396) or preserve (array merge) | |
| json1 | No | First JSON document. Note: This tool merges two raw JSON documents in-memory. It does NOT update database tables. Use mysql_json_update or mysql_json_set to update a table. | |
| json2 | No | Second JSON document | |
| patch | No | Alias for json2 | |
| source | No | Alias for json2 | |
| target | No | Alias for json1 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Error code (e.g. VALIDATION_ERROR, QUERY_ERROR) | |
| data | No | ||
| error | No | Error message if operation failed | |
| details | No | Additional error context | |
| metrics | No | Token estimation metrics | |
| success | Yes | Whether the operation succeeded | |
| category | No | Error category (validation, query, connection, internal) | |
| suggestion | No | Suggested fix for the error | |
| recoverable | No | Whether the error is recoverable |