Maaz Zindani

Loading the index…

↑↓ move↵ openesc close3993 pages

Free tool · Developer tools

JSON compare

Paste two JSON documents and see exactly which paths were added, removed or changed. Both stay on your device: nothing is uploaded.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Options
Differences
4 differences
Added
2
Removed
1
Changed
1
ChangePathBeforeAfter
Changed$.price9.9912.5
Added$.tags[2]"eco"
Removed$.stock.store3
Added$.color"blue"

How to use the JSON Compare

  1. Paste the older JSON into First JSON (before) and the newer one into Second JSON (after), or load each from a file.
  2. Tick Ignore array order if the order of list items should not count.
  3. List any keys to skip, such as updatedAt, under Ignore these keys.
  4. Read the count and the table under Differences. Copy list copies the changes as plain text.

How do I compare two JSON files?

Paste or load both documents. The tool parses each one, walks them side by side, and reports every place they differ as a path. A path such as $.stock.store means: start at the root ($), go into the key stock, then the key store. List positions are written [0], [1] and so on, and keys with spaces or symbols are written ["my key"].

Each difference has one of three kinds. Added means the path exists only in the second document, removed only in the first, and changed that both have it with different values. A value that changes type, for example the number 1 becoming the string "1", counts as changed, because they are different in JSON even though they look alike. The example loaded on this page has four differences: a changed price, an extra list item, a removed key and an added key.

Formatting never matters. Spaces, line breaks and indentation are ignored, so a minified file and a pretty-printed one with the same data show no differences.

Does key order matter, and how are arrays compared?

Key order does not matter. In JSON an object is a set of named values, so {"a":1,"b":2} and {"b":2,"a":1} are the same and are reported as identical.

Array order does matter by default, because a JSON array is an ordered list. Comparing [1,2,3] with [3,2,1] reports a change at position 0 and position 2. When the order is not meaningful, as with a list of tags, tick Ignore array order. Items are then matched by value, objects inside arrays are matched whatever their key order, and what is left over is reported as removed or added at a path ending in [*], since there is no position to point to. Duplicates are counted: two copies of "a" against one copy report one removed.

Without an ordering rule, a single inserted item at the start of a long array moves every later item and produces many changes. If that is not what you want, either tick the option or compare after sorting the lists yourself.

How do I ignore some fields, and what if the JSON is invalid?

Type key names separated by commas under Ignore these keys, for example updatedAt, id. Those keys are skipped at every depth, in both documents, and also when arrays are matched with the ignore-order option. This is the usual way to compare two API responses that differ in timestamps or generated identifiers. It matches key names only, not paths, so a key with that name is skipped wherever it appears.

If either document is not valid JSON, the tool says which one, and repeats the parser's message, which usually names the position. Common causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, and comments, none of which JSON allows.

The comparison is code running in your page. There is no network request, so private documents such as customer records or configuration stay on your device. Numbers are compared as JavaScript reads them, so integers beyond 9,007,199,254,740,991 may lose precision before they are compared.

Use it with

Questions

How do I compare two JSON files?

Paste or load them into the two boxes. The tool lists every path that was added, removed or changed, with the old and new values.

Does key order matter when comparing JSON?

No. Objects with the same keys and values are identical whatever order the keys are in.

Does array order matter?

By default yes, because arrays are ordered. Tick Ignore array order to match items by value instead.

How do I ignore some fields?

List the key names, comma separated, under Ignore these keys. They are skipped at every depth.

Can I compare JSON from a file?

Yes. Use the file button under either box. The file is read on your device and never uploaded.

Is my JSON sent anywhere?

No. The comparison runs in your browser, so the data stays on your device.

How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.