# JSON Patch Generator

Create a JSON Patch (RFC 6902) that turns one JSON document into another. Paste the original and the changed document, and the tool lists the add, remove and replace operations with JSON Pointer paths. Optionally add test operations so the patch only applies to the exact original.

## Frequently asked questions

### What is a JSON Patch?

JSON Patch, defined in RFC 6902, is a JSON array of operations such as add, remove, replace, move, copy and test. Each operation has a path written as a JSON Pointer, such as /users/0/name. HTTP APIs accept it with the media type application/json-patch+json.

### Which operations does the generator produce?

It produces add, remove and replace operations, plus test operations when you turn them on. Applying the patch to the original document gives exactly the changed document.

### What do the test operations do?

A test operation checks that a value is what the patch expects before it is changed. If someone has changed the document in the meantime, applying the patch fails instead of silently overwriting their change.

### How are arrays compared?

Array items are compared by position. Removing an item from the middle of an array therefore shows up as replace operations for the following positions and a remove at the end, rather than a single remove.

### How are special characters in keys written?

Following RFC 6901, a slash in a key is written as ~1 and a tilde as ~0. The key a/b therefore appears in a path as /a~1b.

### What if the two documents are equal?

The result is an empty array, which is a valid patch that changes nothing.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
