All tools

JSON Merge Patch (RFC 7396) Applier

JSON

Apply an RFC 7396 JSON Merge Patch document to a target JSON document and return the merged result, with null-valued keys in the patch removing the corresponding target key.

JSON Merge Patch (RFC 7396) is the simpler cousin of JSON Patch: instead of a list of add/remove/replace operations, it is just a JSON document shaped like the target, where each key overwrites the matching key and a null value deletes it. It shows up as the request body format for PATCH endpoints in a lot of REST APIs, since it is easy to hand-write and easy to diff. This tool applies a patch document to a target document you paste in and shows the merged result. It follows the spec exactly: a patch value of null removes that key from the result, a nested object patch merges recursively, and a patch that is itself not a JSON object (an array, string, number, or null) replaces the target wholesale rather than merging into it, since merge patch has no way to address individual array elements. Everything runs locally with nothing uploaded.

jsonmerge-patchrfc7396patchdiff

How to use JSON Merge Patch (RFC 7396) Applier

  • 1.Paste the target JSON document into the left box.
  • 2.Paste the RFC 7396 merge patch document into the right box.
  • 3.Read the merged result below, including any keys the patch removed with a null value.

Frequently asked questions

What does a null value in the patch do?
It removes the matching key from the target. To set a key's actual value to null, use JSON Patch (RFC 6902) instead, since merge patch has no way to distinguish 'set to null' from 'delete'.
How are arrays handled?
Merge patch never merges arrays element by element. If a key's patch value is an array, it replaces the target's array (or any other value) wholesale, exactly as if it were a string or number.
What happens if the patch is not a JSON object at all?
Per RFC 7396, the entire target is replaced by the patch value. Patching any document with a bare string, number, array, or null discards the original document completely.
Is this the same as JSON Patch (RFC 6902)?
No. JSON Patch is a list of explicit operations (add, remove, replace, move, copy, test) addressed by JSON Pointer paths and can express things merge patch cannot, like inserting into the middle of an array. Merge patch trades that expressiveness for a format that reads like the document it is patching.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/json-merge-patch \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"target":"{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\"}}","patch":"{\"a\":\"z\",\"c\":{\"f\":null}}"}'

Get an API key from your dashboard · Full API docs →