JSON Patch Generator

Generate an RFC 6902 JSON Patch by comparing two documents. Paste the original JSON as input, add the modified version in Tool Settings, and click Run.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about JSON Patch

How to Generate JSON Patch (RFC 6902)

JSON Patch

When to Use JSON Patch

Generate RFC 6902 patch operations when APIs accept partial updates, you need audit trails of document changes, or you want incremental sync instead of sending full JSON bodies.

Real-World Examples

{"op":"replace","path":"/name","value":"Lin"} — change a single field

{"op":"add","path":"/tags/-","value":"new"} — append to an array

Compare before/after config files to produce a minimal patch for deployment scripts

Common Mistakes

  • Using JSON Merge Patch (RFC 7396) syntax — this tool outputs RFC 6902 operations
  • Wrong path format — paths must be JSON Pointers starting with /
  • Expecting patches on invalid or differently-ordered JSON to match semantic intent

Developer Tips

  • Paste original JSON first, modified JSON second
  • Libraries: fast-json-patch for apply and compare in Node.js
  • Review remove operations carefully — they are destructive

Frequently asked questions

What patch format is produced?

RFC 6902 operations such as add, remove, replace, move, copy, and test.

How are array changes represented?

Array append uses path /arrayName/- with op add. Index changes use numeric path segments like /items/0.

Can I apply the patch programmatically?

Yes. Use an RFC 6902 library to apply the generated operations array to the original document.