Functions That Modify JSON Values mysql>  SELECT JSON_MERGE_PATCH(’{ "a": 1, "b":2 }’, > ’{ "a": 3, "c":4 }’); +-----------------------------------------------------------+ | JSON_MERGE_PATCH(’{ "a": 1, "b":2 }’,’{ "a": 3, "c":4 }’) | +-----------------------------------------------------------+ | {"a": 3, "b": 2, "c": 4} | +-----------------------------------------------------------+ mysql>  SELECT JSON_MERGE_PATCH(’{ "a": 1, "b":2 }’,’{ "a": 3, "c":4 }’, > ’{ "a": 5, "d":6 }’); +-------------------------------------------------------------------------------+ | JSON_MERGE_PATCH(’{ "a": 1, "b":2 }’,’{ "a": 3, "c":4 }’,’{ "a": 5, "d":6 }’) | +-------------------------------------------------------------------------------+ | {"a": 5, "b": 2, "c": 4, "d": 6} | +-------------------------------------------------------------------------------+ You can use this function to remove a member by specifying  null  as the value of the same member in the seond argument, as shown here: mysql>  SELECT JSON_MERGE_PATCH(’{"a":1, "b":2}’, ’{"b":null}’); +--------------------------------------------------+ | JSON_MERGE_PATCH(’{"a":1, "b":2}’, ’{"b":null}’) | +--------------------------------------------------+ | {"a": 1} | +--------------------------------------------------+ This example shows that the function operates in a recursive fashion; that is, values of members are not limited to scalars, but rather can themselves be JSON documents: mysql>  SELECT JSON_MERGE_PATCH(’{"a":{"x":1}}’, ’{"a":{"y":2}}’); +----------------------------------------------------+ | JSON_MERGE_PATCH(’{"a":{"x":1}}’, ’{"a":{"y":2}}’) | +----------------------------------------------------+ | {"a": {"x": 1, "y": 2}} | +----------------------------------------------------+ JSON_MERGE_PATCH()  is supported in MySQL 8.0.3 and later. JSON_MERGE_PATCH() compared with JSON_MERGE_PRESERVE().   The behavior of JSON_MERGE_PATCH()  is the same as that of  JSON_MERGE_PRESERVE() , with the following two exceptions: • JSON_MERGE_PATCH()  removes any member in the first object with a matching key in the second object, provided that the value associated with the key in the second object is not JSON  null . •If the second object has a member with a key matching a member in the first object, JSON_MERGE_PATCH() replaces  the value in the first object with the value in the second object, whereas  JSON_MERGE_PRESERVE() appends  the second value to the first value. This example compares the results of merging the same 3 JSON objects, each having a matching key "a" , with each of these two functions: mysql>  SET @x = ’{ "a": 1, "b": 2 }’, > @y = ’{ "a": 3, "c": 4 }’, > @z = ’{ "a": 5, "d": 6 }’; mysql>  SELECT JSON_MERGE_PATCH(@x, @y, @z) AS Patch, -> JSON_MERGE_PRESERVE(@x, @y, @z) AS Preserve\G *************************** 1. row *************************** Patch: {"a": 5, "b": 2, "c": 4, "d": 6} Preserve: {"a": [1, 3, 5], "b": 2, "c": 4, "d": 6} • JSON_MERGE_PRESERVE( json_doc ,  json_doc [,  json_doc ] ...) 2368