JSON Patch (RFC 6902)
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:
- Paste Source and Target JSON.
- Generate patch produces the minimal RFC 6902 ops needed to transform source → target.
- The patch appears below as JSON; copy or download.
Apply:
- Switch to Apply tab. Paste Source JSON and a Patch JSON array.
- Run applies operations top-to-bottom. The result and a log appear below.
- If any
testop 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.