~/json-diff

JSON Diff

Compare two JSON documents structurally — key order and formatting are ignored. See added, removed, and modified fields with their paths. Export as RFC 6902 JSON Patch.

before (left)0 chars
after (right)0 chars
Paste two JSON values and the diff appears live. Try to see it in action.
// how to use

Compare two JSON values in three steps.

  1. 01Paste two JSON documents.Put the original on the left and the modified version on the right. The tool parses both and computes a structural diff live as you type.
  2. 02Read the changes.Each entry is colored by type: green for added, red for removed, yellow for modified, gray for unchanged. The path tells you exactly where in the structure the change happened. Toggle “changes only” to hide the unchanged rows.
  3. 03Export as JSON Patch.Switch to the “patch” view to get an RFC 6902 JSON Patch document — a standardized list of operations (add/remove/replace) you can apply programmatically with most JSON Patch libraries.
// background

Why structural diff beats text diff for JSON.

Tools like diff, git diff, or Meld treat their inputs as lines of text. That works great for source code, but it breaks down for JSON — and most other structured formats. A reordered key, a different indentation style, or a trailing newline all show up as “changes” even when nothing actually changed in the data.

A structural diff parses both inputs as JSON, then walks the resulting trees to find real semantic differences. Key order doesn't matter. Whitespace doesn't matter. What matters is: is this value present in both? Did its content change? Was a new field added? That's what this tool does.

The three kinds of change

+ addedA path exists in the right document but not in the left
removedA path exists in the left document but not in the right
~ modifiedThe same path exists in both, but the value differs
· unchangedThe value is identical in both — useful for context, hidden by 'changes only'

What is a JSON Pointer?

Each change is identified by a JSON Pointer (RFC 6901) — a slash-separated path that addresses a specific location in a JSON document. For example, /user/address/city points to the city field of the address object inside user. The tool also displays a friendlier dot/bracket notation (user.address.city) for readability.

JSON Patch (RFC 6902): the export format

JSON Patch is a standard for describing changes to a JSON document as an array of operations. Each operation has an op (add, remove, replace, move, copy, test), a path (JSON Pointer), and optionally a value. This is the format used by HTTP PATCH requests in REST APIs that follow the spec.

Why use JSON Patch over a custom format?

  • It's standardized — libraries exist in every major language
  • It's reversible — applying an inverse patch undoes the change
  • It's compact — only the operations are transmitted, not the full document
  • It's auditable — perfect for logging changes to user data over time
  • It composes — multiple patches can be merged or applied in sequence

Real-world use cases

  • Comparing two API responses while debugging
  • Reviewing config file changes before deploying
  • Spotting drift between staging and production environments
  • Auditing what fields a webhook payload differs from the previous one
  • Validating that a transformation produced the expected output
  • Building undo/redo functionality on structured data
// faq

Frequently asked questions.

How is this different from a regular text diff?+
A text diff treats JSON as plain strings, so reordering keys, changing whitespace, or formatting differently shows up as 'changes' even though the data is identical. CrunchAPI's diff parses both inputs as JSON and compares structurally — key order, whitespace, and formatting are ignored. Only real semantic differences are reported.
What's RFC 6902 JSON Patch and why would I use it?+
JSON Patch is a standardized format for describing changes to a JSON document as a list of operations (add, remove, replace). It lets you transmit, store, or apply diffs programmatically — useful for syncing data between client and server, audit logs, or version control of structured data. Most languages have a fast-json-patch library that consumes this format.
Can I diff two arrays of different lengths?+
Yes. The tool walks both arrays in parallel: items present only in the longer array are reported as 'added' or 'removed', and items at the same index that differ are reported as 'modified'. Note: the diff is positional, not order-aware. If you need order-independent array diffing (matching by ID), that's a different problem and on the roadmap.
Why are some changes showing as 'modified' instead of separate add/remove?+
When a value at the same path changes type or content (e.g., a string becomes a number, or a number changes value), the tool reports it as 'modified' to keep the output compact. Internally, JSON Patch represents this as a single 'replace' operation, which is more efficient than remove + add.
Are my JSON inputs sent to your server?+
No. The entire diff computation happens in your browser using JavaScript. The tool is delivered as static files; there's no application backend that could receive your data. You can verify in the network tab — no requests are made when you compare.
How big can my JSON inputs be?+
Browser memory is the only real limit. Inputs of several megabytes work fine on modern hardware. Beyond that, performance and UI responsiveness degrade. For very large diffs, consider command-line tools like jd or json-diff-rs.