Someone hands you a diff report and it is a list of lines like CHANGED age: 31 -> 32. The list is short, but reading it well is a skill: each line is a claim about one path in the document, and misreading one leads to fixing the wrong thing, or waving through a change that mattered.
A JSON diff report is not a side-by-side view of two documents. It is the distilled result of a structural comparison: everything that stayed the same has been removed from view, and what remains is a list of differences, each labelled by kind and located by path. This guide explains the three kinds of entry and how paths work, using reports from the free JSON Diff Checker on Ovatly, which runs entirely in your browser.
Contents
- Quick answer
- The three kinds of change
- Paths: how the report tells you where
- A type change counts once
- Arrays are read by index
- How to read a diff report, step by step
- Worked example: two entries, line by line
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Every line in a JSON diff report is one of three kinds. Added means the path exists in the second document and not in the first. Removed means it exists in the first and not in the second. Changed means it exists in both with different values. Unchanged content is never listed, key order is ignored, and 1 and 1.0 count as the same number. If either document is invalid JSON, there is no report at all: the JSON Diff Checker names the failing side and produces no partial diff.
The three kinds of change
Added and removed are mirror images, and which one you see depends on which document you treat as the earlier one. A field that appears in the newer document is added; a field that disappears is removed. Neither word carries a judgement: an added field might be a feature landing as planned, or a value leaking into a response that should never contain it. The report states the fact; judging it is your job.
Changed is the third kind, and it always carries two values: what the path held in the first document and what it holds in the second. That pairing is what makes the report readable at speed. You never open either file, never search for the field, and never guess which of the two numbers is the new one: the entry gives you the path and both values in one line.
Paths: how the report tells you where
A path is the address of a value inside the document: the chain of keys, and array positions, you would follow from the top down to that value. In a flat object the path is just the key, like age or city. In a nested object the path walks down through the parents, so a change buried three levels deep is still reported at its exact location, not as a vague note that something differs.
Reading paths first is the habit that makes reports fast: scan them and you know which parts of the document moved before you look at a single value.
A type change counts once
When a value changes its type, from a number to a string, from an object to null, the report shows one changed entry at that path. It does not show a removal of the old value plus an addition of the new one.
That choice keeps the count honest: a type change is one event, and counting it twice would send you hunting for a second change that does not exist. When the two values in a changed entry have different shapes, read it as a type change and judge it as one item.
Arrays are read by index
Objects are compared by key, and key order is ignored. Arrays are different: an array is a sequence, so its elements are compared by index. The first element of one array is set against the first element of the other, the second against the second, and so on.
The consequence to remember is the insertion shift. Add one element near the start of an array and every element after it sits at a new index, so each of those positions can read as changed even though the same values are present. That is not noise: for ordered data, position is meaning, and a shift is a real structural fact. So a long run of changed entries inside one array is often a single insertion, not many separate edits.
How to read a diff report, step by step
- Open the JSON Diff Checker and put the earlier document on one side and the later document on the other. Keep the sides consistent, or added and removed swap meaning between reports.
- Run the comparison. If a side is invalid JSON, the tool names it and stops; fix the syntax and run again.
- Read the paths first, top to bottom, to see where the document moved.
- Then read the values: for each changed entry, the old value and the new one; for added and removed entries, the value that appeared or vanished.
- Judge each entry on its own: a report is a list of facts, and each one needs a decision, expected or a problem.
Worked example: two entries, line by line
Take these two small documents. The earlier one:
{"name":"Ana","age":31}
The later one:
{"name":"Ana","age":32,"city":"Lisbon"}
The report is two lines:
CHANGED age: 31 -> 32
ADDED city: "Lisbon"
The first line is a changed entry. The path is age. The old value, from the first document, is 31; the new value is 32. One field, one change, both values in front of you.
The second line is an added entry. The path city exists in the second document and has no counterpart in the first, so there is no old value to show; the entry gives the value that appeared, "Lisbon".
The most instructive part of the report is what is missing. The name field is in both documents with the same value, so it earns no line. In a diff report, silence means identical, and the longer the documents, the more valuable that silence is.
Limitations and honest tradeoffs
A diff report shows differences, not correctness. An empty report means the two documents are structurally identical; it says nothing about whether the values in them are right. A field can be wrong in both and produce no entry.
If either side is invalid JSON, there is no partial report to read. The tool names the failing side and stops, which protects you from trusting a half comparison, but means syntax problems must be fixed before any value differences become visible.
Finally, keep the array shift effect in mind on array-heavy documents: the entries are accurate, and reading one insertion as twenty changes is a reader error, not a tool error.
Common mistakes
- Reading added as bad and removed as worse. The kinds are neutral. Judge each entry by what the field is and why it moved.
- Counting a type change as two problems. It is one changed entry and one decision.
- Ignoring the paths and only counting lines. Ten entries in one array after an insertion are not the same story as ten entries across ten objects.
- Comparing with the sides swapped. Added and removed trade places, and a feature landing looks like a feature removed.
- Expecting the report to catch a wrong-but-identical value. If both documents carry the same wrong value, there is no difference to report.
FAQs
What does a changed entry show me? The path where the difference sits and both values: the old value from the first document and the new value from the second. You never have to open either document to find it.
A value changed from a number to a string. Is that two entries? No. A type change is reported as one changed entry at that path, not as a removal plus an addition. One entry, one thing to judge.
Why does a key that only moved position not appear in the report? Because key order is ignored: an object whose keys are serialised in a different order is the same object, and unchanged content is never listed.
Why does my array show so many changed entries after one insertion? Arrays are compared by index, so inserting an element shifts every later element into a new position, and each shifted position reads as a change.
What if one of the two documents is invalid JSON? There is no report: the tool names the side that failed to parse and produces no partial diff, so you fix the syntax and compare again.
Conclusion
A diff report rewards a simple discipline: paths first, then values, each entry judged on its own. Read that way, even a report drawn from very large documents stays a short, honest list. The JSON Diff Checker produces these reports in your browser. For a worked routine built on the same report, see our guide on comparing test output against an expected JSON baseline, and for the rest of the series, browse our Data and JSON Tools guides.
References
- RFC 8259, the JSON data interchange format: https://www.rfc-editor.org/rfc/rfc8259
- MDN Web Docs, on the JSON format and working with it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON