JSON Compare & Diff

Paste JSON on the left and right, then click Compare. Differences are highlighted in place. Ignore array order is in the right column header (off by default).

About this JSON compare tool

Paste JSON on the left and right, then click Compare. Differences are highlighted inside the two boxes—there is no separate result pane. Ignore array order is a checkbox in the right column header.

Object key order is not treated as a difference. Arrays match by index unless you turn on Ignore array order. Invalid JSON shows which side failed, often with line and column. For trailing commas or comments, fix on JSON repair & validate first.

JSON comparison — background

Structural equality vs text diff

JSON comparison here walks parsed values: objects, arrays, strings, numbers, booleans, and null. A plain text diff would flag reordered keys or whitespace; this tool ignores object key order so {"b":1,"a":2} equals {"a":2,"b":1}. What you see is semantic structure, not byte-for-byte text.

Arrays: order-sensitive by default

In JSON, array order matters: [1,2] and [2,1] are different values. Many API tests compare arrays by position. When you only care about multiset equality (same elements, any order), enable Ignore array order—then matching uses deep equality without index alignment.

Moves vs edits in nested data

If an object inside an array both moves and changes a field, the engine may report it as one removal on the left and one addition on the right rather than a single “moved” marker. That is normal for tree diff without stable object IDs—focus on whether the highlighted values match your intent.

Numbers, duplicates, and escapes

  1. JSON.parse may print 1.0 as 1 in pretty output; numeric value is unchanged.
  2. Duplicate keys in one object: parsers typically keep the last occurrence—compare uses parsed data, not raw duplicate text.
  3. Unicode escapes and literal characters can compare equal after parse (e.g. \u4f60 vs 你).

Typical use

Before and after an API change

Paste production vs staging responses side by side. Key shuffle from serializers will not noise the diff; array order still matters unless you ignore it.

Config or fixture review

Compare checked-in JSON fixtures when a test fails—spot added keys (green), removed keys (red), or changed values (amber).

Frequently asked questions

How do I compare two JSON files or strings online?
Paste left and right JSON and click Compare. Colors appear in the same boxes: red only on the left, green only on the right, amber when the value differs. Copy either side with the copy control. Processing stays in your browser.
Does JSON object key order matter when comparing?
Not on this page. Key order is ignored for objects. Each side still displays keys in the order shown after compare (pretty-printed from parsed data).
How to compare JSON arrays when order should not matter?
Check Ignore array order in the right header, then Compare again (or toggle after both sides have text). [1,2] and [2,1] will match when the option is on.
What do red, green, and amber mean in the JSON diff?
Red: value only on the left (removed relative to the other side). Green: only on the right (added). Amber: present on both sides but different values (changed). The legend under the boxes repeats the same three labels.
How is JSON compare different from text diff?
Text diff compares lines or characters. This tool parses JSON first, ignores object key order, and compares structure and values—better for API payloads than raw string diff.
Can I compare nested JSON objects?
Yes. Nesting depth does not matter; differences propagate as colored spans in the formatted text on each side.
What if my JSON is invalid or has trailing commas?
Compare stops and shows which side failed, with line/column when possible. Use JSON repair & validate to produce strict JSON, then return here.
Should I sort keys before comparing JSON?
Not required here—key order is already ignored. Sorting both sides A→Z on JSON key sorter can still help human reading of raw text outside this tool.
Why did an item show as delete plus add instead of change?
Common when Ignore array order is on and an array element both moved and changed— the matcher treats it as removed from one index and added elsewhere. Check the highlighted values, not only the color category.