Compare two JSON documents

Compare two JSON documents and list added, removed, changed, and type-changed paths.

freeworks offlinenothing uploaded
ToolJSON Diff
Input
Output
—

How it works

Both texts are parsed, object keys are compared recursively, arrays are matched by index, and primitive changes are classified as changed or type_changed. Each difference records a dollar path and old or new value before aggregate counts are returned.

  • Objects are key-matched while arrays use positions.
  • Dollar paths make nested changes easy to locate.

Worked example

Changed Fields
Compare two user objects with different values
Input
											Input1: {"name": "Alice", "age": 30, "city": "Portland"}
Input2: {"name": "Alice", "age": 31, "city": "Seattle"}
										
Output
												Path    Type     Old value  New value
------  -------  ---------  ---------
$.age   changed  30         31
$.city  changed  Portland   Seattle
											

When to use this

Release config reviews, regression fixtures, and migration exports use structural comparisons.

Edge cases

  • Reordering an array appears as index changes rather than a set reorder.
  • A number-to-string change is type_changed.
  • Object key order alone produces no difference.

References