json_merge_patch

json_merge_patch(JsonDocument, Patch)

The json_merge_patch function provides a way to patch a target JSON document with another JSON document. The patch function conforms to (href=https://tools.ietf.org/html/rfc7386) RFC 7386

Keys in JsonDocument are replaced if found in Patch. If the value in Patch is null then the key will be removed in the target document.

json_merge_patch('{"a":"b"}',          '{"a":"c"}'
--------------------------------------------------
{"a":"c"}

json_merge_patch('{"a": [{"b":"c"}]}', '{"a": [1]}'
---------------------------------------------------
{"a":[1]}

json_merge_patch('[1,2]',              '{"a":"b", "c":null}'
------------------------------------------------------------
{"a":"b"}


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.