{ }jsonkit
Format
Validate
Convert
Query
Generate

JSON Patch and Merge Patch generator

Generate or apply RFC 6902 JSON Patch and RFC 7386 merge patches.
Mode
219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
167 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10
✓ complete219 B → 127 B0.0 ms

About JSON Patch / Merge Patch

This tool generates and applies JSON Merge Patch (RFC 7386) and JSON Patch (RFC 6902). Paste an original as A and a target as B to get the patch between them, or paste a document and a patch to apply it.

A merge patch looks like the target with only the changed keys, and null deletes a key. JSON Patch is an ordered list of add, remove, replace, move, copy and test operations addressed by JSON Pointer, the format many APIs expect in an HTTP PATCH body.

Runs in your browser. Nothing is uploaded.

How it works

Four modes: generate or apply, merge or patch

The mode switch has Gen merge, Apply merge, Gen patch and Apply patch. In the generate modes, A is the original and B is the target. In the apply modes, A is the document and B is the patch. The output is pretty-printed JSON, either the patch or the resulting document.

Merge patch (RFC 7386): compact and readable

A merge patch mirrors the shape of your object and lists only the keys that changed. A null value deletes that key, and nested objects merge recursively. It cannot delete one array element or set a value to null on purpose, so it suits simple config-style updates.

JSON Patch (RFC 6902): ordered operations

A JSON Patch is an array of operations (add, remove, replace, move, copy and test), each pointing at a location with a JSON Pointer (RFC 6901). Pointers use ~1 for a slash and ~0 for a tilde in keys, and - appends to an array. Apply mode runs the operations in order, and a failing test stops the patch.

Array handling when generating a patch

When generating a JSON Patch, objects are compared key by key. If two arrays differ at all, the tool emits one replace for the whole array instead of per-element operations. That keeps generated patches predictable. Write element-level operations by hand and use Apply patch if you need them.

Frequently asked questions

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

JSON Merge Patch (RFC 7386) looks like your target and lists only changed keys, with null meaning delete. JSON Patch (RFC 6902) is an ordered list of add, remove, replace, move, copy and test operations addressed by JSON Pointer. Merge patch is easier to read. JSON Patch is more precise and better for arrays.

How do I apply a JSON Patch to a document?

Choose Apply patch, paste the document into A and the patch array into B. The operations run in order and the result is shown. Choose Apply merge for an RFC 7386 merge patch.

Does null delete a key in a merge patch?

Yes. A key set to null in a merge patch is removed from the target. That is also why a merge patch cannot set a value to null on purpose. Use a JSON Patch replace operation for that.

Is my JSON uploaded anywhere?

No. Generating and applying patches runs in your browser, and the tool works offline.

Why does my generated patch replace the whole array?

When generating an RFC 6902 patch, the tool replaces a changed array as a whole instead of computing element-level operations. That keeps the output correct and predictable. For per-element edits, write the operations by hand and use Apply patch.

Sources & last verified

We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.

Found a wrong result or an outdated claim? Report an error and we will check it again.