Skip to content

Menu

JSON Patch Builder

Build RFC 6902 JSON Patch operations

Runs entirely in your browserJSON ToolsFree, no sign-up
Loading tool

01What is JSON Patch Builder?

JSON Patch (RFC 6902) describes changes to a JSON document as a list of operations such as add, remove and replace, each targeting a JSON Pointer path. The builder has two modes. In Auto Generate you paste an Original JSON and a Modified JSON and click Generate Patch. It walks both documents recursively: new keys become add operations, missing keys become remove, changed primitives become replace, and nested objects are diffed level by level. Keys containing ~ or / are escaped as ~0 and ~1, as RFC 6901 requires, and a change to the whole document uses the empty pointer "" (not "/", which means a key named with an empty string). When a value changes type, for example an array becoming an object, it is replaced as a whole. Arrays are compared by index, so extra items are added at the end and surplus items removed from the end, last index first so the indexes stay valid. In Manual Build you assemble operations yourself, choosing add, remove, replace, move, copy or test, with a from field for move and copy and a value that's parsed as JSON when possible (anything that isn't valid JSON is kept as a plain string). The patch is then applied by a full RFC 6902 implementation: add inserts into arrays rather than overwriting and accepts - for the end, remove and replace require the target to exist, move refuses to move a value into its own child, copy duplicates, and test compares values by JSON equality, so 1 and "1" are different. Operations run in order and the patch is atomic: if any operation fails, you get an error naming the operation and nothing is applied. This implementation passes all 108 enabled cases in the community json-patch-tests suite, and every generated patch was checked by applying it with fast-json-patch. Paths only follow an object's own keys, so a pointer like /__proto__/x is rejected instead of reaching the browser's built-in objects. Copied patches contain only the members each operation defines (no stray value on a remove). After generating or applying, you'll see the operation count, the patch itself and a Result Preview, and Copy Patch grabs the JSON.

API developers, backend engineers, Kubernetes operators and QA engineers writing tests for document updates. The tool runs entirely in your browser, so your data never leaves your device.

02How to use JSON Patch Builder

  1. Pick Auto Generate or Manual Build.
  2. Paste your Original JSON, and in auto mode the Modified JSON too.
  3. In manual mode, click Add Operation, then set the op, the /path and any from or value fields.
  4. Click Generate Patch or Apply Patch and review the generated patch and Result Preview.
  5. Click Copy Patch to take the operations as JSON.

03Worked examples

Input: Original {"name":"a","tags":["x","y","z"]} → Modified {"name":"a","tags":["x"]}
Result: [{"op":"remove","path":"/tags/2"},{"op":"remove","path":"/tags/1"}]
Array items are removed from the end first so the earlier indexes stay valid while the patch is applied.
Input: Original {"a/b":1,"c~d":2} → Modified {"a/b":5}
Result: [{"op":"replace","path":"/a~1b","value":5},{"op":"remove","path":"/c~0d"}]
In a JSON Pointer, / inside a key is written ~1 and ~ is written ~0.
Input: Original [1,2] → Modified [2,1,3]
Result: [{"op":"replace","path":"/0","value":2},{"op":"replace","path":"/1","value":1},{"op":"add","path":"/2","value":3}]
Arrays are compared index by index, so a swap shows up as two replaces, not as a move.
Input: Original {"v":1} → Modified {"v":"1"}
Result: [{"op":"replace","path":"/v","value":"1"}]
The number 1 and the string "1" are different values, so a replace is generated.
Input: Apply to {"l":[1,2]}: [{"op":"add","path":"/l/-","value":3}]
Result: {"l":[1,2,3]}
The - token means the end of the array, so add appends.
Input: Apply to {"v":1}: [{"op":"test","path":"/v","value":2}]
Result: Error: Operation 1 (test) failed: value at "/v" is not equal to the test value
A failing test stops the whole patch, which is how test guards the operations after it.

04Common use cases

  • Building the request body for a PATCH endpoint that accepts application/json-patch+json
  • Producing a minimal diff to store as an audit trail of document changes
  • Writing test fixtures for a backend that applies patches with fast-json-patch or jsonpatch in Python
  • Creating Kubernetes JSON patches for kubectl patch --type=json
  • Understanding exactly what changed between two API responses

05Tips

  • Use a test operation in Manual Build to check the preview fails the way your server would when the document doesn't match.
  • Inserting an item in the middle of an array shows up as several replace operations plus an add, because diffing is index based.
  • A test operation placed first makes a patch fail safely if the server's document has changed since you read it.
  • Kubernetes also accepts JSON merge patches, which are simpler for plain object updates; use RFC 6902 when you need array index control.

06Related concepts

RFC 6902, JSON Pointer, HTTP PATCH, JSON Merge Patch, Diff.

Frequently Asked Questions

What is JSON Patch Builder?

JSON Patch Builder is a free, browser-based developer tool on AIDToolStack. Build RFC 6902 JSON Patch operations It requires no installation or sign-up and works entirely in your browser.

Is JSON Patch Builder free to use?

Yes. No sign-up, no fees and no usage cap.

Does JSON Patch Builder store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe