NV ToolkitFormat · Validate · Convert

JSON Tools

JSON Compare — Diff Two JSON Documents

Side-by-side JSON diffing with VS Code's engine — highlighted changes, editable panes, and key-order-insensitive comparison.

In short

Compare two JSON files online in a side-by-side diff: highlighted changes, format and sort keys before comparing, and a precise changed-region count. Free.

By NaveenKumar T · Updated

Learn: What is JSON? A Practical Introduction

  • Side-by-side highlighted diff
  • Both panes fully editable
  • Sort keys to ignore ordering

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Learn more

Comparing JSON the right way

Raw text diffs lie about JSON: a reordered key, a re-indented block, or a trailing-comma cleanup lights up the whole file in red while changing nothing semantically. The fix is normalization — parse both documents, sort their keys, serialize them identically — and only then diff. This tool builds that workflow into two buttons: Compare (format both) and Sort keys (normalize ordering), and the underlying rule is RFC 8259 itself: object member order is not significant, so a diff that treats reordering as a change is reporting noise.

The diff itself is VS Code's: changed lines highlighted side by side, intra-line changes emphasized, unchanged regions foldable. The status bar's changed-region count gives you the one number a review needs. Sort both sides with the JSON sorter before comparing when the producers serialize keys in different orders; for YAML manifests or XML configs, the YAML diff and XML diff pages use the same side-by-side engine with format-aware highlighting. Once you've found what changed, RFC 6902 JSON Patch is the machine-readable way to describe the same edit as a list of operations, if a diff needs to be applied programmatically rather than just read.

A worked comparison

An order status update, shown left (before) and right (after): the status field changed, a trackingNumber key was added, and the customer object's keys were reordered without any value changing.

Compare highlights three regions: the status line, the new trackingNumber line, and — because Sort keys was not used here — the reordered customer keys, even though id and name still hold the same values. Running Sort keys on both sides first removes that third region entirely and leaves only the two changes that matter.

Left (before)
{
  "orderId": "ORD-4471",
  "status": "processing",
  "customer": {
    "id": "cus_88f2",
    "name": "Elena Petrova"
  },
  "items": [
    { "sku": "SKU-1", "qty": 2 }
  ],
  "total": 84.50,
  "currency": "USD"
}
Right (after)
{
  "orderId": "ORD-4471",
  "status": "shipped",
  "customer": {
    "name": "Elena Petrova",
    "id": "cus_88f2"
  },
  "items": [
    { "sku": "SKU-1", "qty": 2 }
  ],
  "currency": "USD",
  "total": 84.50,
  "trackingNumber": "1Z999AA10123456784"
}

Typical comparison workflows

Config drift: paste production config left, staging right, sort keys, and read the real differences in seconds. API versioning: capture a response before and after a deploy and verify only the intended fields moved. Data debugging: paste an expected fixture against an actual payload to find the field that broke a test.

Help

Frequently asked questions

Everything you need to know about the JSON Compare.

01How do I compare two JSON files?

Paste the original document on the left and the modified one on the right (or click Sample to see it in action). Click Compare to format both sides consistently — differences are highlighted line by line, and the status bar counts the changed regions.

02The documents are 'different' only because key order changed — can I ignore that?

Sort keys re-serializes both documents with keys sorted alphabetically at every level, so two semantically identical documents with different key order diff as identical. This is the right way to compare API responses across versions.

03Can I edit the documents during comparison?

Both panes are live editors. Fix a line on either side and the diff updates immediately — handy for working through a config drift item by item until the documents converge.

04Can I compare two API responses that differ only in key order and whitespace?

JSON object members carry no defined order — RFC 8259 §4 says so explicitly — so a response re-serialized with a different key order or different indentation is the same document, not a real change. Sort keys, clicked before Compare, normalizes both sides so the diff shows only fields whose values actually moved.

05How large a document can I diff?

The editor renders multi-megabyte documents without issue; the practical ceiling is your device's memory rather than any size limit this page imposes. Very large diffs with many scattered changes are easier to scan in Code view with unchanged regions folded than in the default side-by-side layout.

Keep working

Related tools

Learn the format

Related guides

All guides →