JSON Patch / Diff Generator

Generate RFC 6902 JSON Patch operations by diffing two JSON objects, or apply a patch to a document. Structural JSON comparison — not line-by-line text diff.

Your data never leaves your browser Available via MCP

How to Use

  1. Select Generate Patch mode to diff two JSON objects.
  2. Paste the original JSON in the left panel and modified JSON in the right panel.
  3. Click Generate Patch to see the RFC 6902 operations.
  4. Switch to Apply Patch mode to apply a patch array to a document.

Understanding JSON Patch Operations

JSON Patch defines six operations: add (insert a value), remove (delete a value), replace (change a value), move (relocate a value), copy (duplicate a value), and test (verify a value). Each operation includes an op field, a path (JSON Pointer), and optionally a value or from field.

Use Cases

  • API versioning — compute minimal diffs between API responses
  • Configuration management — track changes to config files
  • Database migrations — generate update operations from schema diffs
  • Real-time sync — send only changed fields over the wire (like CRDTs)

Related Tools

Format JSON output with the JSON Formatter. Validate JSON syntax with the JSON Validator. Compare text line-by-line with the Diff Checker. Generate schemas from JSON with the JSON Schema Generator. Convert JSON to YAML with the JSON-YAML Converter.

Frequently Asked Questions

What is JSON Patch (RFC 6902)?
JSON Patch is a standard format for describing changes to a JSON document. It uses an array of operation objects (add, remove, replace, move, copy, test) with JSON Pointer paths to specify exact locations of changes.
How is JSON Patch different from a text diff?
Text diff compares line-by-line without understanding structure. JSON Patch is a semantic diff that understands JSON structure — it knows the difference between adding a key, modifying a value, and reordering array elements. The output is itself valid JSON that can be programmatically applied.
What is JSON Pointer?
JSON Pointer (RFC 6901) is a syntax for identifying specific values within a JSON document. Paths use "/" as separator: "/address/city" refers to the "city" key inside "address". Array indices are numeric: "/tags/0" refers to the first element.
Can I apply a patch to a document?
Yes. Switch to "Apply Patch" mode, paste your document and a patch array, and the tool will produce the patched result.
Is my data safe?
Yes. All diff generation and patch application happens entirely in your browser. No data is sent to any server.

Use this tool from AI agents. The CodeTidy MCP Server lets Claude, Cursor, and other AI agents use this tool and 46 others directly. One command: npx @codetidy/mcp

Drop file to load