jsontoolskit.org
JSON and JSON Schema utilities, in the browser
Say hi →

JSON Patch (RFC 6902)

generate or apply · add / remove / replace / move / copy / test

Generate an RFC 6902 JSON Patch from A → B, or apply a patch to a document. The patch format used by Kubernetes' kubectl patch --type=json and many HTTP PATCH APIs. For simpler merge semantics, see json-merge-patch (RFC 7396).

Patch (apply mode only)

Output

Paste source and target.

How to generate or apply a patch

Generate:

  1. Paste Source and Target JSON.
  2. Generate patch produces the minimal RFC 6902 ops needed to transform source → target.
  3. The patch appears below as JSON; copy or download.

Apply:

  1. Switch to Apply tab. Paste Source JSON and a Patch JSON array.
  2. Run applies operations top-to-bottom. The result and a log appear below.
  3. If any test op fails, the patch aborts at that step — typical RFC 6902 semantics.

FAQ

What is the difference vs json-merge-patch?

RFC 6902 is surgical — each op describes one change to one path. RFC 7396 patches look like the target document. RFC 6902 can express things merge-patch cannot (like modifying one element of a long array).

What does the test op do?

Asserts a value at a path. If the assertion fails, the patch aborts. Useful for optimistic concurrency.

Will it work offline?

Yes — uses fast-json-patch, cached after first load.