JSON Diff

Diff two JSON values instantly in your browser — a structural comparison that reports added, removed, and changed fields, unaffected by key order.

0 chars 0 Bytes
0 chars 0 Bytes

What Is a JSON Diff?

A plain text diff compares two files line by line — which means reformatting a JSON file (reordering keys, changing indentation) shows up as a wall of changes even when the actual data is identical. A structural JSON diff instead compares the two documents as data: it walks matching keys and array positions and reports only what's actually different, regardless of key order or whitespace.

At a Glance
Compares data, not lines Key order and whitespace are ignored
Exact path per change e.g. $.user.tags[2]
Instant, in your browser No upload, no server round-trip

Why Diff JSON Structurally?

When comparing two API responses, two config versions, or a before/after snapshot of some data, what you actually want to know is which fields changed — not which lines moved. A structural diff answers that directly: added fields, removed fields, and changed values, each with the exact path to where it happened.

How This Tool Works

This diff tool runs entirely in your browser. Paste the original JSON on the left and the changed version on the right, click Compare, and get a report of every difference — or a confirmation that both are structurally identical. Your data is never uploaded to any server — the comparison happens locally on your device.

Structural Diff vs. Text Diff

FeatureText DiffJSON Diff (this tool)
ComparesLines of textData — keys, values, array positions
Key orderAny reordering shows as changedIgnored — {"a":1,"b":2} equals {"b":2,"a":1}
Whitespace/indentationAny formatting change shows as changedIgnored entirely
OutputLine-by-line additions/removalsField-by-field additions/removals/changes, with the exact path
Best forSource code, plain textJSON data, API responses, config snapshots

Reading the Output

Each line in the report starts with a symbol showing what kind of change it is:

  • + path: value (added) — the field exists only in the right-hand JSON
  • - path: value (removed) — the field exists only in the left-hand JSON
  • ~ path: old → new — the value at that path changed

Paths use $ for the root, .key for object fields, and [index] for array positions — for example, $.user.tags[2].

A Note on Arrays

Arrays are compared position by position (index 0 against index 0, and so on), not by matching similar items across different positions. Inserting an item at the start of an array will show every following item as "changed" at its new index, rather than being recognized as a pure insertion — a limitation shared with most simple diff tools, and worth keeping in mind when comparing reordered lists.

Common Scenarios for Diffing JSON

Comparing Two API Responses

When an API's response changes between versions or environments, a structural diff shows exactly which fields were added, removed, or changed — without false positives from the two responses simply serializing their keys in a different order.

Reviewing a Config Change

Before merging an update to a JSON config file, diffing the old and new versions confirms exactly what's changing, which is especially useful when the file was also reformatted at the same time and a plain text diff would show the whole file as different.

Debugging a Test Failure

When an assertion compares two JSON objects and fails, pasting both sides here shows precisely which field diverged instead of leaving you to compare two large printed objects by eye.

Auditing a Data Migration

After migrating data between systems, diffing a sample record's before-and-after JSON confirms the migration preserved every field correctly, and flags anything that was dropped, added, or transformed unexpectedly.

Tracking Down an Unexpected State Change

When a JSON blob (a Redux store snapshot, a saved settings object) changes unexpectedly between two points in time, diffing the two snapshots pinpoints exactly which field changed. If you're archiving both snapshots for a report, our PDF Compressor keeps the accompanying PDF write-up small.

Other Ways to Diff JSON

You can also diff JSON by formatting both files (e.g. with jq -S . file.json to sort keys) and comparing them with a regular text diff tool like diff or your code editor's built-in file comparison view. FileCast is useful for a quick, one-off comparison without formatting each file yourself first.

Frequently Asked Questions

Is it safe to compare my data here?

Yes. This tool processes both inputs entirely in your browser. Nothing is uploaded to any server — the comparison happens locally on your device. No one else can see or access your data during or after comparison.

Does key order matter?

No. {"a":1,"b":2} and {"b":2,"a":1} are reported as identical, since JSON objects are unordered by definition — this tool compares the data, not the text.

How are arrays compared?

Position by position: index 0 against index 0, index 1 against index 1, and so on. Inserting an item in the middle of an array will show every following item as changed at its new index, rather than being recognized as a pure insertion — see the comparison section above for more on this.

What happens if one side isn't valid JSON?

The tool tells you which side — left or right — failed to parse, along with the underlying syntax error, instead of a generic failure. Fix that side and try again.

Can I compare more than two files, or a whole folder?

This tool compares exactly two JSON values at a time. For comparing many files, you'd need to run this (or a similar structural diff) once per pair.