BYTETOOLS

JSON Patch Generator

Generate an RFC 6902 JSON Patch from two JSON documents, or apply a patch and check that it round-trips. Runs entirely inside your browser.

What is the JSON Patch Generator?

The ByteTools JSON Patch Generator diffs two JSON documents and produces an RFC 6902 patch array of add, remove, replace and move operations, with every path correctly escaped as an RFC 6901 JSON Pointer.

  • RFC 6902 add, remove, replace and move operations
  • RFC 6901 escaped paths, arrays compared by index
  • Every patch verified by applying it back to Document A
  • Applies pasted patches too, including copy and test ops
  • Per-operation counts and a clear message for identical documents
  • Runs entirely in your browser — nothing is uploaded

How to use the JSON Patch Generator

  1. 1

    Paste the source JSON into Document A and the target JSON into Document B.

  2. 2

    Leave 'Detect move operations' ticked to fold matching remove/add pairs into moves, or untick it for a plain patch.

  3. 3

    Click Generate patch and check the operation counts and the green verification banner.

  4. 4

    Copy or Download the patch, or edit it and click 'Apply patch to Document A' to see the result.

About the JSON Patch Generator

The ByteTools JSON Patch Generator diffs two JSON documents and produces an RFC 6902 patch array of add, remove, replace and move operations, with every path correctly escaped as an RFC 6901 JSON Pointer. Arrays are compared by index, and a value that disappears from one place and reappears unchanged elsewhere becomes a single move.

Every generated patch is verified before you see it: the tool applies its own output to Document A and checks the result equals Document B. If the move-optimised patch does not round-trip, it silently falls back to the plain add/remove/replace version, so what you copy always works.

You can also paste someone else's patch and apply it to Document A to see the result, including add, remove, replace, move, copy and test operations. Everything runs 100% locally — neither document nor patch is ever uploaded.

Frequently asked questions

What is a JSON Patch?

It is the RFC 6902 format for describing changes to a JSON document as an array of operations — add, remove, replace, move, copy and test — each pointing at a path. APIs use it so a client can send only what changed instead of the whole resource.

How do I create a JSON Patch from two files?

Paste the original into Document A and the updated version into Document B, then click Generate patch. The operations appear in the patch box with a green banner confirming the patch reproduces Document B exactly.

Why does my patch have no move operations?

A move is only emitted when a removed value reappears somewhere else completely unchanged, and only when the resulting patch still round-trips. If either check fails the tool falls back to the plain remove-and-add form, which is always correct.

Can I apply a patch that someone sent me?

Yes. Paste the patch into the patch box, put the target document in Document A, and click 'Apply patch to Document A'. Invalid operations are reported with the operation number and the reason it failed.

How are arrays diffed?

By index. Elements at the same position are compared to each other, extra elements at the end are appended with a /- path, and surplus elements are removed from the tail — which keeps the patch short and always applicable.

Related tools