In MySQL, JSON_MERGE()
is a deprecated function that merges two or more JSON documents and returns the result.
It was deprecated in MySQL 8.0.3 and is subject to removal in a future release.
Fortunately, the JSON_MERGE_PRESERVE()
function was added in MySQL 8.0.3 as a synonym for JSON_MERGE()
, and it therefore does the same thing that JSON_MERGE()
does/did.
Therefore, instead of using JSON_MERGE()
, use JSON_MERGE_PRESERVE()
instead.
Alternatively, you can use JSON_MERGE_PATCH()
, which performs an RFC 7396 compliant merge of two or more JSON documents, without preserving members having duplicate keys.