JSON Compare Examples
Review JSON compare examples for changed API responses, config files, fixtures, and nested values after both samples parse cleanly.
Validate both sides first
A JSON comparison is useful only when both left and right samples parse as strict JSON before the diff is reviewed.
- Run syntax checks before comparing.
- Format both samples to make field groups easier to scan.
- Keep sample labels clear, such as before and after or expected and actual.
Describe the changed field
A useful comparison note should name the changed path, old value, new value, and whether the change is expected.
- Group added, removed, and changed fields separately.
- Check nested array changes carefully because order can matter.
- Use path examples when a field is buried deep in the response.
Reference Blocks
Use these short blocks as starting notes before opening the calculator.
Diff note
Left sample: expected response Right sample: actual response Changed path: items[0].price Expected: 12.99 Actual: 13.49 Review: pricing source changed
Checklist
Before compare: validate both samples During compare: list added, removed, changed After compare: decide expected change or defect Next: update schema, test, or request example
Worked Examples
Changed value
A test fixture expected price 12.99 but the response sends 13.49.
Record the path and both values before deciding whether the fixture is stale.
Do not update tests until the source of truth is clear.
Missing field
A user object no longer includes phone.
Mark the field as removed and check whether consumers still expect it.
A missing optional field may be acceptable; a missing required field may break clients.
Array order
Two arrays contain the same items in a different order.
Check whether order has meaning for the endpoint or UI.
Some APIs do not guarantee array order.
Common Mistakes
- Comparing invalid JSON and interpreting parser errors as data differences.
- Ignoring array order when it changes the meaning of the response.
- Sharing sensitive values while reporting a diff.
When This Is Not Enough
- A diff shows what changed; it does not decide whether the change is correct.
- Schema, tests, and endpoint documentation should decide expected shape.
- Large responses may need a focused sample around the changed path.