JSON Patch Builder (RFC 6902)

Apply a JSON Patch (RFC 6902) — the operation-based patch format with add, remove, replace, move, copy, test. More expressive than merge patch (can describe array element changes), but more verbose. Also includes a "diff" mode that computes the patch needed to transform one JSON document into another.

How to use the JSON Patch Builder (RFC 6902)

Apply mode: paste the original document and a patch (array of operation objects), get the result. Diff mode: paste two documents, get the patch that transforms A into B. The diff is "shallow" — it uses replace operations for objects rather than computing the minimal patch, but the result applies correctly.

Applying and building a JSON Patch

Sometimes you do not want to send a whole document — you want to describe the change. RFC 6902 JSON Patch does exactly that: an ordered list of operations (add, remove, replace, move, copy, test) that transforms one document into another. It is more verbose than a merge patch but far more precise, because it can target individual array elements and assert preconditions.

This applies a patch to a document and, in diff mode, computes the patch that turns one document into another. Use it when the operations themselves matter — an audit trail, an undo stack, a PATCH request body. When you simply want to combine two objects into one merged result, the JSON merge tool is the simpler fit.

Common use cases

  • Build a PATCH body — produce the RFC 6902 ops an API expects.
  • Diff two documents — compute the patch that transforms one into the other.
  • Audit changes — record edits as an explicit list of operations.
  • Target array elements — describe changes a merge patch cannot express.
  • Apply and verify — run a patch against a document and check the result.

Frequently asked questions

Which operations are supported?

The full RFC 6902 set — add, remove, replace, move, copy, and test.

Can it diff two documents?

Yes — diff mode produces a patch that transforms document A into document B.

How is this different from a merge patch?

A merge patch describes the desired end state; a JSON Patch lists explicit operations, so it can target array elements and assert preconditions.

When would I use JSON merge instead?

When you just want two objects combined into one; the JSON merge tool deep-merges them.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: