JSON Patch Generator & Applier
Generate an RFC 6902 JSON Patch between two documents, apply a patch to a source, or run an RFC 7386 merge patch — entirely in your browser.
The JSON Patch Generator runs entirely in your browser. The documents and patches you paste are diffed and applied on your device and are never uploaded to ArrayKit.
Open the JSON Diff tool
About JSON Patch Generator
The JSON Patch Generator turns the difference between two JSON documents into a clean RFC 6902 operation array — the add, remove, replace, move, and copy steps that transform a source into a target. Switch to Apply mode to run a patch against a source document and see the exact result, with every operation validated so a bad op or a failed test is caught instead of silently skipped. A third mode applies RFC 7386 JSON Merge Patches, where a null value deletes a key and objects merge key by key. It is built for developers wiring up PATCH endpoints, syncing config, or reviewing API changes. Your source, target, and patch are processed on your device and never leave the browser.
Features
- Generate a minimal RFC 6902 patch (add / remove / replace / move / copy) from two JSON documents
- Apply a patch array to a source document and see the patched result instantly
- Validates every operation — unknown ops, failed tests, and unresolvable paths are reported, not skipped
- Apply RFC 7386 JSON Merge Patches where a null value deletes a key
- Key-order-independent diff, so reordered keys never produce noisy operations
- Copy the patch or result, or download it as a .json file
- Live valid / invalid badges pinpoint which side has a JSON syntax error
- Everything runs in your browser — documents and patches stay on your device
How to use the JSON Patch Generator
- Choose Generate to diff two documents, Apply patch to run an RFC 6902 patch, or Merge patch for RFC 7386
- Paste your source JSON on the left
- Paste the target document, patch array, or merge patch on the right
- Read the generated operations or the patched result, then copy or download it
Example
Input
source: {"active":true,"roles":["admin"]}
target: {"active":false,"roles":["admin","editor"]}
Output
[
{ "op": "replace", "path": "/active", "value": false },
{ "op": "add", "path": "/roles/1", "value": "editor" }
]
Generate produces the RFC 6902 operations that turn the source into the target.
Common errors & troubleshooting
- Apply mode says the patch must be an array of operations. — An RFC 6902 patch is a JSON array like [ { "op": "add", "path": "/x", "value": 1 } ]. Wrap a single operation object in square brackets.
- A remove or replace operation fails with an unresolvable path. — The path must already exist in the source. Check for a typo, remember paths start with a slash, and escape / and ~ in keys as ~1 and ~0.
- A test operation makes the whole patch fail. — RFC 6902 patches are all-or-nothing. A failed test aborts the patch, so confirm the tested value matches the source exactly before the following operations run.
- A merge patch replaced an entire array instead of editing one item. — RFC 7386 has no element-level array edits — an array in a merge patch overwrites the whole array. Use an RFC 6902 patch with indexed paths for per-item changes.
Frequently asked questions
- What is an RFC 6902 JSON Patch?
- RFC 6902 is a format that describes changes to a JSON document as an ordered array of operations — add, remove, replace, move, copy, and test — each targeting a JSON Pointer path. Applying the array to the source produces the target.
- How is JSON Merge Patch (RFC 7386) different from JSON Patch (RFC 6902)?
- A merge patch is itself a JSON object that mirrors the target: present keys are set, a null value deletes a key, and arrays and scalars replace wholesale. It is simpler but cannot move values or edit individual array elements the way RFC 6902 operations can.
- How do I generate a patch from two JSON documents?
- Stay on Generate, paste the original on the left and the changed version on the right, and the tool computes the minimal RFC 6902 operation array. The diff ignores key order, so reordered fields do not create spurious operations.
- Why did my patch fail to apply?
- Operations are validated against the source. Common causes are a path that does not exist for remove or replace, a test operation whose value does not match, or an invalid op name. The tool shows the specific error so you can fix that operation.
- Does a merge patch really delete a key with null?
- Yes. In RFC 7386, a property set to null instructs the merge to remove that key from the result. To store an actual null you must use an RFC 6902 replace operation instead.
- Are my JSON documents and patches uploaded anywhere?
- No. The generator, the patch applier, and the merge-patch engine all run locally in your browser. Your source, target, and patch data are processed on your device and are never sent to ArrayKit.
Related tools
- JSON Diff — Compare two JSON documents and see a structural, key-order-independent diff.
- JSON Formatter — Beautify, minify and validate JSON with error locations.
- JSON Flatten / Unflatten — Flatten nested JSON to dot-notation keys, or unflatten it back.
- Sort JSON Keys — Recursively sort JSON object keys alphabetically, with pretty-print and reverse options.
- JSON to CSV — Convert an array of flat JSON objects to CSV.
- NDJSON to JSON — Convert NDJSON / JSON Lines to a JSON array and back, line by line.
All ArrayKit tools