How to Compare Two JSON Files and Find Every Difference
Compare two JSON documents structurally, ignore key and array order, match arrays by id and turn the differences into an RFC 6902 JSON Patch you can apply.

How to Compare Two JSON Files and Find Every Difference
Two API responses that look the same on screen can differ in one nested field, and a configuration file that worked yesterday can break because a single value changed type. A plain text diff is a poor tool for these jobs: it reports lines, not values, and it shouts about whitespace and key order that do not matter to any program. The free JSON Diff and Compare tool parses both documents and compares their structure, so it reports exactly which values were added, removed or changed, with the path to each one.
Why a text diff is not enough
JSON objects are unordered. The two documents {"a":1,"b":2} and {"b":2,"a":1} mean exactly the same thing, but a line-based diff reports them as different. Pretty-printing with a different indent, or moving a key during a refactor, produces a wall of red and green that hides the one change you care about. A structural diff reads the JSON into values first, then compares those values. Key order and formatting disappear from the result, and you see only real changes.
Reading the result
Every difference has three parts: a kind (added, removed or changed), a path such as $.user.roles[2], and the old and new values. A change of type, for example the number 42 becoming the string "42", is reported separately from a change of value, because it is the kind of difference that breaks strict clients while looking harmless to a human reader.
The summary counts each kind, which is handy for a quick check: a deployment that should only change a version number but reports thirty changed values deserves a closer look.
Arrays: by position or by key
Arrays are the hard part of any JSON diff. By default, arrays are compared position by position, so inserting one item at the start makes every later item look changed. Two options solve this:
- Ignore array order treats arrays as sets of values, useful for tags, permissions or lists of features where order carries no meaning.
- Match by key pairs array items by a field such as
idorsku. A list of users or products is then compared item by item even if the order changes, and a new user shows up as one addition instead of a cascade of changes.
Number tolerance
Values computed by different systems often differ in the last digits: 0.30000000000000004 versus 0.3. A small tolerance stops these from being reported, which matters when comparing results from two calculation engines or two versions of a pricing service.
Turning the difference into a patch
The tool also writes the differences as a JSON Patch, the standard format from RFC 6902. A patch is a list of operations such as add, remove and replace, each with a JSON Pointer path. You can store it, send it in a PATCH request or apply it in code with any JSON Patch library to turn the first document into the second. The tool can apply a patch too, which is a good way to check that a patch you were given does what you expect before running it against production data.
Practical uses
- API regression testing: save a known good response and compare each new build's response against it.
- Configuration drift: compare the settings of staging and production to find the one flag that differs.
- Data migrations: check a record before and after a migration script to confirm only the intended fields changed.
- Code review: paste the old and new fixture files to see what a pull request really changes in test data.
Step by step
- Paste or load the original JSON on the left and the changed JSON on the right.
- Choose whether array order matters, and enter a key field if arrays hold objects with ids.
- Set a number tolerance if small floating-point differences should be ignored.
- Read the list of differences and their paths.
- Copy the JSON Patch if you need to apply the same change elsewhere.
Privacy
Both documents are parsed and compared in your browser. Nothing is uploaded, so you can safely compare responses that contain tokens, customer records or internal settings. For very large files, close other heavy tabs first, because the whole comparison runs in memory on your device.



