JSON Merge Patch Generator & Applier

Generate a standard RFC 7396 JSON Merge Patch between two documents, or apply a merge patch to a document. The simplest way to express "just send the changed fields" — used by GitHub's API and many REST PATCH endpoints.

Input
Result

Features

🔀 RFC 7396 Compliant

  • Generates the minimal merge patch between two documents
  • Applies a merge patch exactly per the spec's own algorithm
  • null in a patch deletes a key
  • Arrays are always replaced wholesale, never merged

⚡ Privacy-First

  • All computation happens in your browser
  • No data ever sent to a server
  • Both directions available: generate and apply
  • Download or copy the result instantly

🔗 Real-World Use

  • Debug PATCH request bodies sent to REST APIs
  • Understand exactly what a webhook payload changed
  • Pairs with our JSON Patch (RFC 6902) tool
  • Verify a merge patch round-trips to the expected document

JSON Merge Patch Guide

JSON Merge Patch (RFC 7396) is the simpler of the two JSON patch standards: instead of a list of explicit operations, a merge patch is just a JSON document that looks like the target, containing only the fields that changed. Applying it means recursively merging the patch into the target — any key set to null in the patch is deleted from the target, any other key's value replaces the target's value at that key, and keys the patch doesn't mention are left untouched.

This simplicity is also its main limitation: because a merge patch can't distinguish "replace this array element" from "replace the whole array," RFC 7396 always replaces arrays wholesale rather than diffing them element by element. If you need array-aware, operation-based patching, use JSON Patch (RFC 6902) instead — the two standards solve overlapping but different problems, and picking the right one usually comes down to whether the API you're integrating with already specifies one.

Frequently Asked Questions

How is this different from JSON Patch (RFC 6902)?

JSON Patch is a list of explicit operations (add, remove, replace, move, copy, test) targeting exact paths — more expressive, but more verbose. Merge Patch is just "the new document, with only what changed" — simpler to read and write by hand, but can't express array element changes or explicitly test a value before applying.

Why do arrays get fully replaced instead of merged?

RFC 7396 treats anything that isn't a JSON object as an atomic value to be replaced outright — this includes arrays. There's no standard way in a merge patch to say "change just the third element," so the entire array in the patch replaces the entire array in the target.

What if I actually want a field's value to be null, not deleted?

This is a known limitation of RFC 7396: a merge patch cannot set a field to literal null, since null in the patch always means "delete this key." If you need to distinguish "set to null" from "remove entirely," JSON Patch's explicit replace operation handles that correctly.

Where is JSON Merge Patch actually used in practice?

GitHub's REST API accepts merge patches for many PATCH endpoints — send just the fields you want to change (e.g. updating an issue's state without resending its title or body). It's a common choice for APIs where clients typically only ever change a handful of fields at once, since the request body ends up much smaller than resending the whole resource.