Paste two JSON objects above, then click Generate Patch
Produces RFC 6902 compliant JSON Patch array// diff two json objects → get rfc 6902 patch
Compare two JSON objects and generate RFC 6902 JSON Patch documents instantly. Build, test, and export add, remove, replace, move, copy, and test operations.
Paste two JSON objects above, then click Generate Patch
Produces RFC 6902 compliant JSON Patch arrayEnter the original JSON object in the left editor.
Enter the updated JSON object in the right editor.
Click Generate Patch to get the RFC 6902 patch array ready to use.
JSON Patch (RFC 6902) is a format for describing changes to a JSON document. It's used in HTTP PATCH requests and any system that needs to describe transformations efficiently without sending the whole document.
RFC 6902 defines the JSON Patch format — a sequence of operations applied to a JSON document. Each operation is an object with an op, path, and optionally value or from field. It's the standard format used in HTTP PATCH requests.
The tool generates add, remove, and replace operations based on the diff. When you enable "Include test ops", it also inserts test operations before replacements to verify preconditions before applying the patch.
Yes. The tool recursively traverses nested objects to produce precise JSON Pointer paths (e.g. /user/address/city). Array diffing uses index-based comparison for straightforward structural changes.
Send an HTTP PATCH request with Content-Type: application/json-patch+json and the generated patch array as the request body. Your server must implement RFC 6902 handling — libraries exist for Node.js, Python, PHP, Go, and more.
JSON Pointer (RFC 6901) is the path format used in JSON Patch. A leading / separates each key, so /user/name points to { "user": { "name": "..." } }. Array indices are numeric: /items/0. Special characters ~ and / are escaped as ~0 and ~1.
No. All diffing and patch generation runs entirely in your browser using JavaScript. Your JSON data never leaves your device. The tool is completely client-side for maximum privacy.
A JSON Patch Builder is a tool that compares two JSON objects — an original and a modified version — and produces a JSON Patch document conforming to RFC 6902. This patch document describes exactly what changed: which keys were added, removed, or replaced, expressed as a minimal array of operation objects.
Instead of transmitting a complete JSON document to update a resource, you can send only the patch — a compact, precise description of the difference. This is especially valuable in REST APIs where HTTP PATCH semantics are used, and in systems where bandwidth, atomicity, and auditability matter.
💡 Looking for professional web development assets? MonsterONE offers unlimited downloads of templates, UI kits, and developer tools — worth checking out.
RFC 6902 is the Internet standard for JSON Patch, published by the IETF. A patch document is a JSON array where each element is an operation object. The six defined operation types are:
All paths in JSON Patch use the JSON Pointer format defined in RFC 6901. A JSON Pointer is a string that identifies a specific value within a JSON document. It begins with / and each reference token is separated by /. For example, to reference document.user.address.city, the pointer is /user/address/city.
The root of the document is referenced by an empty string "". Array elements are addressed by their zero-based index: /items/0 is the first element of the items array. The special characters ~ and / in key names must be escaped as ~0 and ~1 respectively to avoid ambiguity.
The tool performs a recursive structural diff of the two JSON objects. It traverses all keys in both documents simultaneously and determines the minimal set of operations needed to transform the original into the modified version:
add operationremove operationreplace if leaf values differWhen "Include test ops" is checked, a test operation is prepended before each replace, asserting the original value. This enables safe patching on servers that enforce preconditions.
JSON Patch is the preferred approach for partial updates in REST APIs over alternatives like JSON Merge Patch (RFC 7396). While Merge Patch is simpler, it cannot express "remove this key" without setting it to null, and it cannot perform atomic conditional operations. JSON Patch is more expressive and enables:
test operations to assert current state before applying changes, preventing race conditions.Both RFC 6902 (JSON Patch) and RFC 7396 (JSON Merge Patch) describe partial update formats, but they differ in approach. Merge Patch is simpler: you send a document with only the changed fields, and null means delete. JSON Patch is more powerful: you send an explicit list of operations. Choose Merge Patch for simple REST APIs where you control both client and server. Choose JSON Patch when you need atomicity, conditional operations, or the ability to remove array elements precisely by index.
This tool generates the patch document for you. To apply it server-side, you'll need a library for your stack. Well-maintained implementations include fast-json-patch for JavaScript/Node.js, jsonpatch for Python, php-json-patch for PHP, and json-patch for Go. All adhere to RFC 6902 and correctly handle nested paths, array indices, and the test operation.
JSON Patch is widely used in modern software systems. It powers collaborative document editing where multiple users simultaneously edit a JSON-backed document and changes are exchanged as patches. It's the backbone of conflict-free replicated data types (CRDTs) in distributed systems. Configuration management tools use it to describe incremental changes to settings files. Mobile applications use it to sync local state changes to a backend without sending full payloads over metered connections. Any system where documents evolve over time benefits from storing diffs as patches rather than full snapshots.