JSON Diff
Compare two JSON documents structurally
Original JSON
Modified JSON
How to use JSON Diff
- •Paste your first JSON document into the left panel. This is typically the "before" or "expected" version.
- •Paste your second JSON document into the right panel. This is the "after" or "actual" version.
- •Review the diff output. Added keys are highlighted in green, removed keys in red, and changed values show both the old and new value side by side.
- •Use the diff to debug your API, migration, or configuration change.
What is structural JSON diffing?
A plain text diff compares files line by line. Reordering the keys in a JSON object — which is semantically meaningless because JSON objects are unordered — produces a massive text diff even though nothing actually changed. Structural JSON diffing solves this by comparing the parsed data tree rather than the raw text.
The algorithm walks both JSON trees in parallel. When it encounters a key present in one tree but not the other, it reports an addition or removal. When both trees share a key, it recursively compares the values. For arrays, it compares elements by index. This approach means that whitespace differences, key ordering, and formatting variations are all ignored — only real data changes surface.
Structural diffing is especially valuable when debugging REST APIs. You make a request, get a response, change a parameter, make the request again, and want to know precisely what changed in the response. A text diff is noisy; a structural diff shows exactly which fields were affected.
Common use cases
- •API regression testing: Compare the response from two versions of an endpoint to catch unintended changes in field names, missing data, or type changes.
- •Configuration auditing: Diff a production config against staging to verify that the only differences are the ones you intended.
- •Database migration validation: Export records as JSON before and after a migration, then diff to ensure no data was lost or corrupted.
- •PR review: When a pull request modifies a large JSON fixture file, paste both versions here to see the real semantic changes without formatting noise.
FAQ
Q: Does key order matter? A: No. JSON objects are unordered by specification, and this tool respects that. Two objects with the same keys in different orders are treated as identical.
Q: How are arrays compared? A: Arrays are compared element-by-element by index. If one array is longer, the extra elements are reported as additions or removals.
Q: Can I compare JSON with comments or trailing commas? A: The tool requires valid JSON. Strip comments and trailing commas first, or use our JSON Formatter tool to clean the input.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.
How to use JSON Diff
- Paste your first JSON document into the left panel. This is typically the "before" or "expected" version.
- Paste your second JSON document into the right panel. This is the "after" or "actual" version.
- Review the diff output. Added keys are highlighted in green, removed keys in red, and changed values show both the old and new value side by side.
- Use the diff to debug your API, migration, or configuration change.
What is structural JSON diffing?
A plain text diff compares files line by line. Reordering the keys in a JSON object — which is semantically meaningless because JSON objects are unordered — produces a massive text diff even though nothing actually changed. Structural JSON diffing solves this by comparing the parsed data tree rather than the raw text.
The algorithm walks both JSON trees in parallel. When it encounters a key present in one tree but not the other, it reports an addition or removal. When both trees share a key, it recursively compares the values. For arrays, it compares elements by index. This approach means that whitespace differences, key ordering, and formatting variations are all ignored — only real data changes surface.
Structural diffing is especially valuable when debugging REST APIs. You make a request, get a response, change a parameter, make the request again, and want to know precisely what changed in the response. A text diff is noisy; a structural diff shows exactly which fields were affected.
Common use cases
- API regression testing: Compare the response from two versions of an endpoint to catch unintended changes in field names, missing data, or type changes.
- Configuration auditing: Diff a production config against staging to verify that the only differences are the ones you intended.
- Database migration validation: Export records as JSON before and after a migration, then diff to ensure no data was lost or corrupted.
- PR review: When a pull request modifies a large JSON fixture file, paste both versions here to see the real semantic changes without formatting noise.
FAQ
Q: Does key order matter? A: No. JSON objects are unordered by specification, and this tool respects that. Two objects with the same keys in different orders are treated as identical.
Q: How are arrays compared? A: Arrays are compared element-by-element by index. If one array is longer, the extra elements are reported as additions or removals.
Q: Can I compare JSON with comments or trailing commas? A: The tool requires valid JSON. Strip comments and trailing commas first, or use our JSON Formatter tool to clean the input.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.