TBToolbox
Developer Tools

Compare JSON

Compare JSON parses two documents, short-circuits subtrees whose JSON.stringify output matches, then recursively visits object and array keys and prints differing leaf values as root.path: left → right. Object key order differences normally disappear at recursive comparison, but array order matters. The report has no escaping for dotted keys, move detection, JSON Patch, type-aware numeric tolerance, ignore paths, or downloadable result.

Runs locally — files stay on your device
Quick answer

Does array order matter?

Yes. Elements are compared by index.

Structural diff needs path and equality rules

This implementation uses strict serialized equality for subtrees and recursive key traversal otherwise; it does not define semantic equivalence beyond parsed JSON values.

How it works

Both inputs are parsed, object keys are unioned recursively, and leaf mismatches are stringified into lines.

Key concepts

Arrays are index paths

Insertion near the start can create many differences.

Dot paths are ambiguous

A property containing a dot looks nested.

When to use it

  • Find simple value changes between small JSON documents.
  • Inspect changed array indices.
  • Confirm two parsed values are equal.

When not to use it

  • Do not expect move/rename detection.
  • Do not use dotted-key paths as unambiguous JSON Pointers.
  • Do not compare numbers with tolerances.

Worked examples

Leaf change

Input
{"a":1} versus {"a":2}
Expected output
root.a: 1 → 2

One line.

Equal data

Input
Same parsed value
Expected output
The JSON values are equal.

No differences.

Array reorder

Input
[1,2] versus [2,1]
Expected output
Two index differences

No move detection.

Common mistakes

Expecting text diff

Whitespace is discarded by parsing. Correction: Use a source diff for lexical changes.

Interpreting insertions as edits

Index comparison cascades. Correction: Use an array-aware diff.

Assuming JSON Pointer paths

Dots are not escaped. Correction: Use a standard patch/diff tool.

Best practices

  • Use on small trusted documents.
  • Review arrays carefully.
  • Use JSON Patch-compatible tooling for machine application.

Related operations and differences

CSV Column Extractor

Choose CSV Column Extractor when you need to extract one CSV column by header name.; use Compare JSON specifically for json compare.

CSV Column Remover

Choose CSV Column Remover when you need to remove one CSV column by header name.; use Compare JSON specifically for json compare.

CSV Duplicate Remover

Choose CSV Duplicate Remover when you need to remove completely duplicated CSV rows.; use Compare JSON specifically for json compare.

CSV Formatter

Choose CSV Formatter when you need to normalize CSV quoting and row structure.; use Compare JSON specifically for json compare.

CSV Row Filter

Choose CSV Row Filter when you need to keep rows whose selected column contains a value.; use Compare JSON specifically for json compare.

CSV Sorter

Choose CSV Sorter when you need to sort CSV rows by a named column.; use Compare JSON specifically for json compare.

Limitations and privacy

  • No JSON Patch, move detection, path escaping, tolerance, ignore rules, sorting option, schema, large-data streaming, or side-by-side rendering.

Input is processed locally in this browser and is not uploaded by the tool.

Frequently asked questions

Is whitespace compared?

No.

Does property order matter?

Not as a leaf difference after parsing.

Are arrays order-sensitive?

Yes.

Can differences be applied automatically?

No.