//: # ()
Need to compare two JSON documents right now? Use our free JSON Diff / Compare tool — paste both sides and see exactly what was added, removed, or changed, by path.
diff-ing JSON as text git diff, and most text diff tools, work line by line. That's a fine model for source code, but it breaks down on JSON for a simple reason: JSON doesn't care about key order or formatting, but a text diff does.
Take these two, semantically identical, JSON objects:
{ "name": "svc", "port": 8080 }
{
"port": 8080,
"name": "svc"
}
A line-based diff will report this as a complete rewrite — every line changed — even though nothing about the actual data changed at all. Reformat a JSON file with a different indent width, or have your editor auto-sort keys, and a text diff will bury the one real change under hundreds of noise lines.
A structural JSON diff parses both documents into actual data (objects, arrays, values) and compares that data directly, independent of formatting or key order. The output isn't "line 14 changed" — it's a set of paths: which field, in the actual object graph, was added, removed, or changed, and what its old and new values were.
server.port changed 8080 → 8443
server.tls added → true
features[2] added → "rate-limiting"
version changed "1.0.0" → "1.1.0"
This is unambiguous, readable at a glance, and immune to reformatting noise.
Structural diffs typically compare arrays by index, not by matching similar objects. If you insert an item at the start of an array, every subsequent item shifts by one position and will show up as "changed" even though its content didn't really change — this is a fundamental limitation of index-based array comparison, not a bug. For arrays where item identity matters more than position (like a list of objects with an id field), a smarter diff would need to match by that identity field first — worth keeping in mind when interpreting array diffs on reordered data.
Paste two JSON documents into the JSON Diff / Compare tool to see every real difference, by path, color-coded by whether it was added, removed, or changed — entirely in your browser.