JSON diff
Compare two JSON objects and highlight differences
JSON Diff
Compare two JSON objects and highlight differences
TL;DR
What is JSON diff?
JSON diff compares two JSON documents and shows the structural differences: added keys, removed keys, and changed values. Unlike a plain text diff, a JSON diff understands the data structure, so object key ordering does not produce false differences.
Common use cases
- ‣API response comparison: compare the output of two API versions or environments to find breaking changes
- ‣Config drift detection: diff a deployed configuration against the expected baseline
- ‣Migration validation: confirm that a data transformation produced the expected output by diffing input and output
- ‣Feature flag comparison: compare JSON configs before and after a flag change to verify only the intended keys changed
Frequently asked questions
Why does JSON diff ignore key ordering?
JSON objects are unordered by definition (RFC 8259). Two objects with the same keys and values in different orders are semantically identical. A structure-aware diff correctly treats them as equal; a plain text diff would flag them as different.
What is the difference between JSON diff and text diff?
Text diff compares files line by line and is sensitive to formatting. JSON diff parses both inputs and compares the resulting data structures, so it ignores whitespace and key ordering. Use JSON diff for structured data comparison and text diff for arbitrary text.
See also
- ‣JSON formatter: format both JSON inputs to a consistent indent level before diffing to remove formatting noise from the output
- ‣Text diff: for non-JSON text comparisons such as config files or plain text, use the line-by-line text diff tool