JSON Patch

Apply JSON Patch (RFC 6902) and JSON Merge Patch (RFC 7396) operations to JSON documents. Full JSON Pointer support and merge patch generation.

Original document
RFC 6902 operations
Used only with Generate Patch

Supported Operations (RFC 6902)

add

Add a value at path

remove

Remove value at path

replace

Replace value at path

move

Move value from path to path

copy

Copy value from path to path

test

Test value equals expected

What is JSON Patch & Merge Patch?

JSON Patch is a standard (RFC 6902) for describing changes to a JSON document using a sequence of operations. It defines six operations — add, remove, replace, move, copy, and test — that can be applied to a JSON document using JSON Pointer (RFC 6901) paths. JSON Patch is widely used in REST APIs for partial updates, real-time collaboration, and configuration management.

How to Use

  1. Paste your source JSON document in the Source JSON field.
  2. Enter your patch operations array in the JSON Patch field following RFC 6902 format.
  3. Click 'Apply Patch' to apply the operations and see the result, or provide a Target JSON and click 'Generate Patch' to create a patch automatically.
  4. Copy the output result or generated patch for use in your application.

Why Use This Tool?

Apply partial updates to JSON documents without sending the entire document
Generate patches automatically by comparing two JSON documents
Full RFC 6902 compliance with all six operations and JSON Pointer support
Client-side processing — your data never leaves the browser

Tips & Best Practices

  • Use JSON Pointer paths starting with / to reference object keys (e.g., /users/0/name for the first user's name)
  • The test operation validates a value before proceeding — if it fails, the entire patch is rejected
  • Use /- as the array index in add operations to append to the end of an array

Frequently Asked Questions

What is JSON Patch (RFC 6902)?

JSON Patch is a format for describing changes to a JSON document. It uses a sequence of operations (add, remove, replace, move, copy, test) applied to a JSON document. It's defined in RFC 6902 and is commonly used in REST APIs with the PATCH HTTP method for partial document updates.

What is JSON Merge Patch (RFC 7396)?

JSON Merge Patch is a simpler format for describing changes to a JSON document. Instead of a sequence of operations, it uses a single JSON object where each property replaces the corresponding property in the original. A null value means "remove this property". Nested objects are merged recursively. It's defined in RFC 7396.

When should I use JSON Patch vs JSON Merge Patch?

Use JSON Merge Patch when you want a simple, intuitive way to update object properties — it's ideal for form submissions and simple partial updates. Use JSON Patch (RFC 6902) when you need fine-grained control like array element manipulation, move/copy operations, or test-and-set conditional updates. Merge Patch cannot merge arrays element-by-element or move values between paths.

What is a JSON Pointer (RFC 6901)?

JSON Pointer is a string syntax for identifying a specific value within a JSON document. It uses / as a separator to traverse object keys and array indices. For example, /users/0/name points to the name property of the first element in the users array. Special characters ~ and / in keys are escaped as ~0 and ~1.

How does null work in JSON Merge Patch?

In JSON Merge Patch, a null value has a special meaning: it indicates that the corresponding property should be removed from the original document. This is different from a regular JSON value of null. If you want to set a property to null rather than remove it, you cannot use JSON Merge Patch — use JSON Patch (RFC 6902) instead.

Is my data secure?

Yes. All patch operations are performed entirely in your browser using JavaScript. Your JSON data is never sent to any server, never stored, and never logged. When you close the page, all data is cleared.

Related Tools