jsonsql.dev100% client-side

JSON Diff

Compare two JSON documents side-by-side and see every difference

Loading JSON Diff...

How to compare JSON online

jsonsql.dev compares two JSON documents instantly in your browser. No data is sent to any server — your JSON stays on your machine.

Paste original JSON — copy your original JSON (from an API response, config file, or database export) and paste it into the left editor.

Paste modified JSON — paste the updated or changed version into the right editor.

Click Compare — the diff appears instantly, highlighting added, removed, and changed values with their JSONPath locations.

Example

Original:

{
  "name": "Alice",
  "age": 30,
  "city": "San Francisco",
  "skills": ["JavaScript", "Python"]
}

Modified:

{
  "name": "Alice",
  "age": 31,
  "country": "US",
  "skills": ["JavaScript", "Python", "Go"]
}

Diff result:

~ $.age        30 → 31            (changed)
- $.city       "San Francisco"      (removed)
+ $.country    "US"                  (added)
+ $.skills[2]  "Go"                  (added)

Features

  • Deep recursive comparison of objects, arrays, and primitive values
  • Color-coded diff: green for added, red for removed, yellow for changed
  • Two display modes: tree view (structured) and inline text diff
  • Summary stats: count of added, removed, changed, and unchanged entries
  • Ignore key order option — compare objects regardless of property ordering
  • Ignore whitespace in string values
  • Drag-and-drop .json files onto left or right panel
  • Swap left/right to quickly reverse the comparison
  • Copy diff result to clipboard
  • Dark and light theme support
  • Works offline — no internet needed after the page loads

JSON Diff vs other tools

Featurejsonsql.devjsoncompare.comjq (CLI)diff (CLI)
Browser-basedYesYesNo (CLI)No (CLI)
Client-side onlyYesNo (server)Yes (local)Yes (local)
Structural diffYesYesNoNo (text only)
Ignore key orderYesSomeWith scriptingNo
JSONPath displayYesNoNoNo
Drag & drop filesYesSomeN/AN/A
Dark modeYesNoN/AN/A
Works offlineYesNoYesYes
No install neededYesYesNoNo

How JSON diff works

A deep JSON diff recursively compares every nested value, detecting additions, removals, and changes at any depth — unlike a text diff which only compares lines.

The algorithm starts at the root of both JSON documents and walks through each key and value. When it encounters an object, it collects all keys from both sides, then recurses into each key's value. When it encounters an array, it compares elements by index — the first element of the original is compared to the first element of the modified, the second to the second, and so on.

Deep vs shallow comparison

A shallow comparison only checks top-level keys and values. If a nested object changes, it reports the entire object as "changed" without specifying which inner field actually differs. A deep comparison (what jsonsql.dev uses) recurses through every level, pinpointing the exact path where a value was added, removed, or modified — for example, $.users[0].address.city instead of just $.users[0].

How arrays are compared

JSON arrays are compared by index, not by value. This means that if you insert an element at the beginning of an array, every subsequent element appears as "changed" because its index shifted. This is a deliberate design choice: JSON arrays are ordered, and index-based comparison preserves that semantic meaning. If you need value-based comparison (e.g., treating arrays as sets), pre-sort them before comparing.

Does key ordering matter?

By default, key order does not affect the comparison result — {"a":1,"b":2} and {"b":2,"a":1} are considered equal because the JSON specification does not define object key ordering. However, you can enable the "Ignore key order" option to also sort the diff output alphabetically for easier reading when comparing objects from different sources that serialize keys in different orders.

Common use cases for JSON diff

Developers reach for a JSON diff tool in many day-to-day workflows:

  • Comparing API responses before and after a code change — deploy a fix, hit the same endpoint, and diff the two responses to verify that only the expected fields changed and nothing else regressed.
  • Debugging configuration file changes — compare two versions of package.json, tsconfig.json, or docker-compose.yml to see exactly which settings were added, removed, or modified during a refactor.
  • Reviewing database migration data — export records as JSON before and after a migration, then diff them to confirm that data transformations applied correctly and no records were lost.
  • Comparing translation files (i18n) — diff two locale JSON files (e.g., en.json vs fr.json) to find missing translation keys or values that were accidentally overwritten.
  • Code review: comparing generated JSON schemas — when auto-generating JSON Schemas or OpenAPI specs, diff successive versions to ensure only intentional changes are introduced.

JSON diff vs text diff

A JSON-aware diff ignores formatting differences and compares the actual data structure, so reordering keys or changing indentation won't produce false positives.

AspectText diff (git diff)JSON diff (jsonsql.dev)
Comparison unitLines of textJSON values (keys, primitives, objects, arrays)
Affected by formattingYes — changing indentation or line breaks creates noiseNo — compares parsed data, not raw text
Key order sensitivityYes — reordering keys shows as a changeNo — objects with the same keys in different order are equal
Path informationLine numbers onlyFull JSONPath (e.g., $.users[0].name)
Semantic understandingNone — treats JSON as plain textUnderstands types (string, number, boolean, null, object, array)
Best forSource code, markdown, general text filesAPI responses, config files, data exports, any structured JSON

When to use which: Use a text diff (git diff) when reviewing source code changes in a pull request. Use a JSON diff when you need to understand what data changed regardless of formatting — for example, comparing an API response before and after a deployment, or checking whether a config change introduced unintended side effects.

Tips for comparing large JSON documents

When working with JSON files that are hundreds of kilobytes or several megabytes, these strategies help you get useful results faster:

  • Enable "Ignore key order" when comparing objects from different sources (e.g., two API servers or two database exports). Different serializers may output keys in different orders, and without this option you'll see false positives for every reordered key.
  • Enable "Ignore whitespace" when comparing pretty-printed JSON against minified JSON, or when string values may have inconsistent spacing. This prevents formatting noise from cluttering the diff.
  • Read the summary stats first — before scrolling through hundreds of diff rows, check the stats bar at the top (e.g., "3 added, 1 removed, 5 changed, 200 unchanged"). This tells you the scope of changes at a glance and helps you decide whether to review every detail or focus on specific sections.
  • Use path filtering mentally — scan the JSONPath column in the diff output to focus on specific sections. For example, if you only care about changes under $.config.database, skip rows that start with other paths. A future update will add built-in path filtering.
  • Pre-process before comparing — for very large files, consider extracting just the section you care about using the JSON Query tool, then comparing those smaller extracts. This reduces noise and speeds up the comparison.

Related tools

Frequently asked questions

What does "Ignore key order" do?

When enabled, two objects with the same keys but in different order are treated as equal. For example, {"a":1,"b":2} and {"b":2,"a":1} will show no differences. This is useful because JSON object key order is not guaranteed by the specification.

How does array comparison work?

Arrays are compared element-by-element by index. If the modified array has more elements, they appear as "added". If it has fewer, the missing elements appear as "removed". Changed elements at the same index show the old and new values.

What is the difference between tree view and inline view?

Tree view shows each difference as a structured row with the JSONPath, change type badge, and old/new values. Inline view shows a traditional text-based diff with + and - prefixes, similar to git diff output.

What's the difference between a JSON diff and a text diff?

A text diff (like git diff) compares lines of text and is affected by formatting, indentation, and key ordering. A JSON diff parses the data structure and compares values semantically — reordering keys, changing indentation, or reformatting the JSON produces no false positives. Use text diff for source code, JSON diff for data.

Can I compare JSON files with different formatting?

Yes. Because jsonsql.dev parses the JSON before comparing, formatting differences like indentation, line breaks, and trailing whitespace are completely ignored. A minified one-liner and a pretty-printed version of the same data will show zero differences.

How do I ignore specific fields when comparing JSON?

Currently, jsonsql.dev compares all fields. To ignore specific fields, you can pre-process your JSON to remove those fields before pasting. Use the JSON Query tool to extract only the fields you care about, then compare the results. Built-in field exclusion is planned for a future update.