Skip to content
ZeroServer.tools

JSON Merge Patch Tool

Generate and apply JSON Merge Patch (RFC 7396) between two JSON objects.

Presets:
Original Size
105 B
Modified Size
108 B
Patch Size
79 B
Keys Mutated
4

About JSON Merge Patch

JSON Merge Patch (RFC 7396) is a simple format for describing changes to a JSON document. Unlike JSON Patch (RFC 6902), a merge patch is itself a JSON object that mirrors the target document — fields present in the patch replace the corresponding fields in the original, and fields with a null value are deleted. Fields absent from the patch are left untouched. Use the Generate Patch tab to compute the minimal merge patch between two objects, or the Apply Patch tab to apply an existing patch to a document. All processing happens entirely in your browser — no data is sent to any server.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Computing the merge patch between two documents.
  • Applying a patch to see the resulting document.
  • Producing a PATCH body for an API that accepts merge patch.
  • Understanding how a patch expresses a removal.
  • Checking a patch's effect before sending it to a live endpoint.

Frequently Asked Questions

What is JSON Merge Patch?
RFC 7386 — a patch document shaped like the target, where present keys are set and `null` means delete. Applying `{"a":1,"b":null}` sets `a` and removes `b`. Its whole appeal is that the patch is readable as a document rather than as instructions.
How is it different from JSON Patch?
JSON Patch (RFC 6902) is an array of explicit operations — add, remove, replace, move, test — addressed by JSON Pointer. It is more capable and much more verbose. Merge Patch is simpler and cannot express everything Patch can.
What is the null limitation?
You cannot SET a value to null, because null already means delete. Any schema where null is a meaningful value is therefore incompatible with Merge Patch — which is the single reason to reach for RFC 6902 instead.
How are arrays handled?
Wholesale replacement. There is no way to modify one element or append — the entire array in the patch replaces the entire array in the target. For a long list with one changed item, that makes the patch as large as the document.
Which content type should the request use?
`application/merge-patch+json` for RFC 7386 and `application/json-patch+json` for RFC 6902, both on a `PATCH` request. Sending either as plain `application/json` leaves the server guessing, which is how a patch gets applied as a full replacement.

Common errors and gotchas

  • Expecting a merge patch to modify one element of an array, which it cannot — arrays are replaced wholesale.
  • Confusing JSON Merge Patch with JSON Patch, which are different specifications with different media types.
  • Using null as a value rather than as a removal instruction, which merge patch cannot distinguish.
  • Assuming the API accepts merge patch, when many accept only JSON Patch or a full PUT.
  • Sending a patch with the wrong content type, which servers reject or misinterpret.

Related Developer Utilities tools

Private & free — this tool runs entirely in your browser.

IndieKitShip your Next.js startup in days.affiliate