AnyTool
Your files never leave your device. All processing happens locally in your browser.

How to compare two JSON documents and see the differences?

AnyTool JSON Diff Visualizer compares two JSON documents structurally, classifying every key and value as added, removed, changed, or unchanged in a collapsible tree. It matches arrays smartly, exports an RFC 6902 JSON Patch, and runs 100% in your browser - no upload, no signup, works offline.

  • Structural diff by value, not text - key order does not matter
  • Smart array matching by LCS, position, or a key field like id
  • Export an RFC 6902 JSON Patch or a readable text diff
  • 100% in your browser - no upload, no signup, works offline

What is

JSON Diff

A JSON diff is a structural comparison of two JSON documents that reports each node as added, removed, changed, or unchanged, ignoring key order and formatting rather than comparing raw text lines.

Developer Tools

Related terms

JSON Patch (RFC 6902)Structural DiffJSON PointerArray Matching

Frequently Asked Questions

No upload. Both documents are parsed and diffed entirely in your browser and never leave your device.

The JSON Diff Visualizer is 100% client-side. Both JSON documents are parsed, diffed, and rendered in your browser, and large inputs run in a local Web Worker. Nothing is uploaded to a server, and it works offline.

It aligns arrays with an LCS algorithm, or you can match items by a key field like id or uuid.

Arrays are matched by a longest-common-subsequence algorithm so inserting or removing one element does not mark everything after it as changed. You can also switch to match-by-index or match-by-key, picking a field such as id, uuid, or name to track objects across reorders.

No. Browser CORS rules block cross-origin fetches, so you paste, drop, or open a .json file instead.

To keep everything client-side and private, the tool does not fetch JSON from arbitrary URLs - browsers block cross-origin requests via CORS. You paste JSON into either pane, drag-drop a file, or open one with the file picker. It also tolerantly parses JSONC comments and auto-repairs malformed JSON.

Open Export and choose Copy or Download JSON Patch to get a valid RFC 6902 add/remove/replace patch.

After the diff runs, open the Export menu and pick Copy JSON Patch or Download JSON Patch to produce a valid RFC 6902 patch with add, remove, and replace operations. You can also copy or download a readable text diff for code review or migrations.

Detailed Explanation

How It Works

Structural JSON Diffing

AnyTool JSON Diff Visualizer compares two JSON documents by structure rather than by text lines. It walks both trees and classifies every key and value as added, removed, changed, or unchanged, attaching a JSON Pointer path to each node. Because the comparison is value-based, reordering object keys or reformatting whitespace does not produce false differences.

  • Classifies nodes as added, removed, changed, or unchanged
  • Key order and whitespace are ignored
  • Each difference carries a JSON Pointer path
Technical Details

Smart Array Matching and JSON Patch Export

Arrays are aligned with a longest-common-subsequence algorithm so inserting or deleting one element does not cascade into a noisy diff. Users can switch to match-by-index or match-by-key, choosing a field such as id, uuid, or name to follow objects across reorders. Every diff also produces a valid RFC 6902 JSON Patch with add, remove, and replace operations, plus a readable text diff, both available to copy or download.

  • LCS, index, and key-field array matching modes
  • Match-by-key supports fields like id, uuid, and name
  • Exports RFC 6902 JSON Patch and a text diff
Privacy & Security

Client-Side Processing and Its Limits

All parsing, diffing, and rendering happen in the browser; large documents are offloaded to a local Web Worker and shown in a virtualized tree so 10 MB-plus JSON stays responsive. Nothing is uploaded and the tool works offline. The honest trade-off is that it cannot fetch JSON from arbitrary URLs, because browser CORS rules block cross-origin requests, so input must be pasted, dropped, or opened as a file.

  • No upload, no server, works offline
  • Large inputs diff in a Web Worker with virtualized rendering
  • Cannot load from arbitrary URLs due to browser CORS
AnyTool JSON Diff Visualizer vs typical online JSON diff tools
CapabilityAnyToolTypical alternative
Privacy / no uploadYes - 100% client-sideOften server-side
PriceFreeFreemium/paywall
Diff typeStructural (value-based)Often text/line diff
Smart array matchingLCS, index, or key fieldRare or index-only
RFC 6902 JSON Patch exportYes - copy or downloadUsually missing
Dark mode and mobileYesOften weak or absent

URL loading is intentionally omitted to keep processing fully client-side.