Structural JSON Diff
Compare two JSON objects key-by-key to detect added, removed, and changed nodes.
Client-Side Execution & Privacy Guarantee
This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.
Text diffs of JSON are noisy because whitespace, key order, and formatting changes obscure real data differences. CodePackr's Structural JSON Diff ignores those surface variations and reports only nodes that were added, removed, or whose values changed.
The comparison walks both trees in parallel. Objects are matched by key name regardless of order; arrays are compared by index. The result is a concise list of paths together with the old and new values, making reviews and debugging far faster.
How structural comparison works
Both documents are parsed into trees. At each object the set of keys is examined: keys present only on the left are removals, keys present only on the right are additions, and keys present on both are recursed into.
Array elements are aligned by position. An insertion or deletion in the middle shifts subsequent indices, so the report shows changes at the affected indices rather than attempting to infer moves.
Types of reported changes
A value change occurs when the same path exists on both sides but the primitive values differ, or when one side has an object and the other has an array or primitive. Type changes are called out explicitly.
Additions and removals are reported at the path where the node appears or disappears. Nested changes inside an added or removed subtree are not expanded; the entire subtree is summarized at the point of insertion or deletion.
Interpreting paths and values
Paths use dot and bracket notation so they can be copied into a JSONPath expression or into application code. Numeric indices appear in brackets. The old and new values are shown in compact form.
When a large object is added, only the path and a size indication are listed. Expand or pretty-print the original documents if you need to inspect the full content of a changed subtree.
When to use this tool
- Two API responses should be identical except for timestamps or generated IDs and you need to confirm the rest matches.
- A configuration change produced unexpected behavior and you want to see exactly which keys were altered.
- You are reviewing a pull request that updates a JSON fixture and want a structural summary instead of a text diff.
- You need to verify that a migration script added the expected new fields and left existing data untouched.
- You are debugging a serializer that sometimes reorders keys or omits optional properties.
How to use the Structural JSON Diff
- Paste the original JSON into the left pane and the modified JSON into the right pane.
- Run the comparison.
- Review the list of added, removed, and changed paths.
- For any unexpected change, copy the path and inspect that location in both original documents.
- If formatting differences were the only variations, the structural report will be empty.
- Iterate on the source documents and re-compare until the remaining differences are the ones you expect.
- Use the path list as a checklist when writing assertions or migration notes.
Worked examples
Added and changed properties
Left: {"name":"Ada","year":1815}
Right: {"name":"Ada Lovelace","year":1815,"field":"math"}
Changed: $.name "Ada" → "Ada Lovelace" Added: $.field "math"
Key order is irrelevant. The year value is identical so it is omitted from the report.
Array element change
Left: {"tags":["a","b"]}
Right: {"tags":["a","c"]}
Changed: $.tags[1] "b" → "c"
Arrays are compared by index. Only the second element differs.
Common mistakes and tips
- Normalize both documents with a JSON formatter first if one of them fails to parse.
- Key order never produces a difference; only values and structure matter.
- Large binary or base64 fields will appear as value changes even if only a few characters differ; consider hashing them separately.
- Array moves are reported as a removal plus an addition at different indices; the tool does not attempt to detect permutations.
- An empty diff means the two documents are structurally identical after parsing.
Frequently asked questions
Does key order affect the result?
No. Objects are compared by key name, not by the order keys appear in the text.
How are arrays compared?
By index. Insertions or deletions shift later indices and are reported as changes at those positions.
Can it ignore certain paths?
The current tool reports every difference. Filter the result list manually or pre-process the documents if you need to exclude fields such as timestamps.
What if one document is invalid JSON?
The comparison cannot run. Validate and correct the syntax first.
Is the data uploaded?
No. Both documents stay in your browser.