JSON Merge Patch

Apply or generate RFC 7396 JSON Merge Patches. Merge two JSON objects or compute the diff patch.

Mode:

Apply a merge patch to a JSON document. Keys set to null in the patch are removed from the result.

What Is the JSON Merge Patch Tool?

The JSON Merge Patch tool implements RFC 7396 — the standard format for partial updates to JSON documents. It has two modes: Apply Patch takes an original JSON document and a merge patch and produces the updated document; Generate Patch takes an original and a target document and produces the minimal merge patch that transforms one into the other.

JSON Merge Patch is widely used in REST APIs for PATCH endpoints. It is simpler than JSON Patch (RFC 6902) and sufficient for most partial update scenarios. The rules are straightforward: keys in the patch overwrite the target, null values delete the key, and absent keys are left unchanged.

How to Use the JSON Merge Patch Tool

  1. Select Apply Patch to apply an existing patch, or Generate Patch to create a patch from two documents.
  2. Click Load Sample to populate the inputs with an example.
  3. In Apply mode: paste the original JSON on the left and the merge patch on the right.
  4. In Generate mode: paste the original JSON on the left and the desired target JSON on the right.
  5. The result appears instantly below. Click Copy to copy it.

Features

  • Apply mode: apply an RFC 7396 merge patch to a JSON document
  • Generate mode: compute the merge patch between two JSON documents
  • Handles nested objects recursively
  • null values in patch correctly delete keys from the result
  • Clear JSON parse error messages
  • Sample data for both modes
  • Runs entirely in your browser — no data sent to servers

FAQ

What is JSON Merge Patch?

JSON Merge Patch (RFC 7396) is a format for describing changes to a JSON document. A merge patch is itself a JSON object. Keys present in the patch overwrite the corresponding keys in the target. Keys with a null value in the patch are removed from the target. Keys absent from the patch are left unchanged.

What is the difference between JSON Merge Patch and JSON Patch?

JSON Merge Patch (RFC 7396) uses a simple object format where null means delete. JSON Patch (RFC 6902) uses an array of operation objects (add, remove, replace, move, copy, test) and is more expressive but more verbose. Merge Patch is simpler and sufficient for most use cases.

How do I delete a key using JSON Merge Patch?

Set the key to null in the patch object. For example, to delete the "email" field, include {"email": null} in your patch. When applied, the email key will be removed from the target document.

Does JSON Merge Patch work with arrays?

Arrays are replaced entirely, not merged. If the patch contains an array value for a key, the entire array in the target is replaced with the patch array. There is no way to add or remove individual array elements using Merge Patch — use JSON Patch (RFC 6902) for that.