JSON Patch & Pointer
Generate an RFC 6902 patch between two documents, apply a patch, resolve a JSON Pointer, or work with RFC 7386 merge patches — pick the mode below. Runs in your browser.
Auto-runs as you type. Ctrl+Enter to re-run. The role of A and B depends on the mode.
How to use JSON Patch & JSON Pointer
Build and test JSON Patch (RFC 6902) operations and resolve JSON Pointer (RFC 6901) paths against a JSON document. Use it to craft an HTTP PATCH body, generate the patch that turns document A into document B, or debug "path not found" and "test operation failed" errors in your API. All operations run in your browser; documents are never uploaded.
What it does
- Apply RFC 6902 patches (
add,remove,replace,move,copy,test) to a target document. - Generate a JSON Patch by diffing two JSON documents — useful for API PATCH bodies.
- Resolve JSON Pointer paths (RFC 6901), including escaped tokens (
~0for~,~1for/). - Apply operations step by step to see intermediate states.
- Explain per-operation failures (target not found, test mismatch, invalid path).
- Copy the patch as JSON ready to send in an HTTP PATCH request.
When to use it
- Implementing or consuming a PATCH endpoint that uses RFC 6902.
- Building the minimal patch that turns a current document into a desired one.
- Debugging "replace target must exist" or "test operation failed" errors.
- Crafting a config update for a system that accepts JSON Patch (e.g., Kubernetes strategic / JSON merge patches).
- Resolving and verifying JSON Pointer paths used in JSON Schema, OpenAPI, or error responses.
- Documenting a series of edits as a patch document.
How to use it
- Paste the target JSON document on the left.
- Enter a JSON Patch array (e.g.,
[{"op":"replace","path":"/user/name","value":"Ada"}]) on the right. - Choose Apply mode to run the patch — the result and any errors per operation appear instantly.
- For a diff: paste the original and the desired JSON, then use Generate patch mode to produce the minimal RFC 6902 ops.
- For Pointer resolution: paste the document, enter a pointer like
/items/0/name, and see the value or error. - Copy the patch JSON into your PATCH request body or test fixture.
Tips & pitfalls
- Operations apply in order — if one fails, later ones do not run. Reorder when needed.
- To append to an array use
/array/-; to insert at an index use/array/0. - Escape special characters in JSON Pointer:
/becomes~1,~becomes~0. - Use
addto create new fields,replaceonly when the path already exists. - The
testoperation is a guard — use it for optimistic concurrency before applying changes. - JSON Patch is not JSON Merge Patch (RFC 7386) — they have different semantics. Confirm which your API expects.
FAQ
- What is JSON Patch (RFC 6902)? A JSON document format for describing changes to another JSON document as an ordered array of operations.
- What is JSON Pointer (RFC 6901)? A string syntax for identifying a specific value inside a JSON document, used by JSON Patch and JSON Schema.
- How do I generate a patch between two JSON objects? Paste both into the diff panel; the tool emits the minimal RFC 6902 operations that turn the source into the target.
- What does the RFC 6902 "target location must exist" error mean? The
remove,replace,move,copy, andtestoperations require the target path to already exist in the document — RFC 6902 rejects the patch if it does not. Onlyaddcreates a new location, and even then its parent object or array must already exist. This tool previews each operation against your source and flags the exact op and path that fails, with a fix hint. - Why does my remove or replace operation fail with "path must exist"? The JSON Pointer points at a location that is not in the current document — usually a typo, a wrong array index, or an unescaped
/or~in a key (use~1for/and~0for~). Switch toaddif you meant to create the value, or correct the path; the tool shows which pointer resolved to nothing. - What does the "
-" path token mean? It refers to the index one past the last element of an array — used byaddto append. - Is JSON Patch the same as JSON Merge Patch? No — Merge Patch (RFC 7386) is a simpler diff/overlay. Patch (RFC 6902) is operation-based and explicit.
- Is my JSON uploaded? No. All patching, diffing, and pointer resolution run in your browser.
Related tools
- Diff two JSON documents to see the changes a patch would describe.
- Validate JSON against a schema before and after applying a patch.
- Format and validate JSON so source and target documents parse cleanly.
- Test JSONPath expressions to locate the paths you want to patch.
- Convert cURL commands to build the PATCH request that sends your patch.
Use-case guides
- RFC 6902: why the remove target location must exist
- JSON Pointer escaping: slash and tilde examples
- JSON Patch vs JSON Merge Patch
- Generate JSON Patch from two JSON files
- Apply JSON Patch online
Runs locally in your browser. No uploads. No analytics on pasted JSON.
Common tasks solved by this tool
- Apply JSON Patch online
- Generate JSON Patch from two JSON files
- Fix RFC 6902 remove target location errors
- Escape slash and tilde in JSON Pointer paths
- Compare JSON Patch and JSON Merge Patch
- Debug an API PATCH request body before sending it
Continue in a JSON/API workflow
Chain this into related tools, or build it as a saved workflow in Workflows.
- Format or inspect JSON
- Compare two JSON documents
- Generate and apply a JSON Patch — this tool
- Validate the result against a schema
Part of the JSON and API contract toolkit
Validate schemas, compare JSON responses, generate JSON Patch operations and debug API contract examples with related privacy-first tools.