What is the JSON Compare?
JSON Compare performs a structural comparison of two JSON documents, reporting added, removed, and changed values by path. Unlike a text diff, it understands that key order does not affect meaning.
Comparing JSON as plain text produces misleading results. Two documents can be byte-for-byte different while representing identical data, different key ordering, different indentation, or different whitespace all show up as changes in a text diff but mean nothing semantically.
A structural comparison parses both documents first and then walks the resulting values. It reports that a specific property changed from one value to another, identified by its path, regardless of where it appeared in the file.
Arrays are the genuinely hard case. Whether the comparison treats an array as an ordered sequence or an unordered set changes the answer completely, and neither interpretation is universally correct, it depends on what the array represents in your data.
How to use the JSON Compare
- Paste the first document. Put the original or reference JSON into the left pane.
- Paste the second document. Put the version you are comparing against into the right pane.
- Review the differences. Each difference is listed by path, showing what changed and how.
- Interpret the change types. Distinguish values that changed, keys that were added, and keys that were removed.
Worked examples
A structural comparison
Key order differs between the two documents, but that is correctly reported as no change.
A: { "name": "api", "port": 8080, "debug": true }
B: { "port": 3000, "name": "api", "retries": 3 }~ /port 8080 -> 3000
- /debug true (removed)
+ /retries 3 (added)
Key order differences are ignored, only
the actual data differences are reported.Differences inside nested structures
Paths make it unambiguous which nested value changed, however deep it sits.
A: { "db": { "host": "localhost", "pool": { "max": 10 } } }
B: { "db": { "host": "localhost", "pool": { "max": 25 } } }~ /db/pool/max 10 -> 25
One change, precisely located.Common use cases
- Comparing configuration across environments. Diffing staging and production configuration surfaces exactly which settings differ.
- Detecting API contract changes. Comparing responses from two API versions reveals fields that were added, removed, or retyped.
- Debugging failing tests. When an assertion on a large object fails, a structural comparison against the expected value pinpoints the mismatch.
- Reviewing data migrations. Comparing a record before and after a transformation confirms only the intended fields changed.
Features and limitations
- Compares parsed structure rather than raw text, so formatting and key order are ignored.
- Reports differences by path, making nested changes unambiguous.
- Distinguishes additions, removals, and value changes.
- Detects type changes, such as a number becoming a string, a common and easily missed source of bugs.
- Array comparison is index-based, so inserting an element near the start reports every subsequent position as changed.
Frequently asked questions
How is this different from a text diff?
A text diff compares characters and reports formatting or key-order changes as differences. This comparison parses both documents and compares the data, so it reports only changes that actually mean something.
Does key order matter?
No. JSON objects are unordered by definition, so two objects with the same keys and values are equal regardless of the order they were written in.
How are arrays compared?
By index, so position matters. Inserting an element at the beginning shifts everything after it and reports many changes. This is the correct behaviour for ordered data, but can be noisy for arrays that are conceptually unordered sets.
Can it detect type changes?
Yes, and this is one of the more valuable things it catches. A value changing from the number 8080 to the string "8080" is reported as a change, even though the two look identical when printed.
Is my data uploaded?
No. Both documents are parsed and compared in your browser, so configuration containing credentials stays local.
What if a document is invalid JSON?
Comparison requires both documents to parse. An invalid document is reported as a parse error instead, use the JSON Validator for detailed diagnostics.
All processing happens locally in your browser, your data never leaves your device.
