Compare JSON API Responses Without Formatting Noise
Find changed fields, choose an array comparison rule, ignore known volatile paths, and export a report with clear limits.
By JSON Lab · Updated
Two API responses can look different because their keys were reordered, or look almost identical while a number became a string. Start with a structural comparison, then decide whether each change breaks the consumer's contract.
Try a response with one real change
Paste this in the left input of JSON Compare:
{"user":{"id":"42","active":true},"roles":["reader","editor"]}
Paste this in the right input:
{"roles":["reader","editor"],"user":{"active":false,"id":"42"}}
Press Compare. Reordered object keys are ignored. The meaningful change is $.user.active, from true to false. Changing whitespace or indentation alone should produce no differences.
Try changing the right-hand ID to the number 42. That adds a type change: "42" and 42 are different values. A missing property, a property set to null, and an empty string are also different.
Choose the array rule before interpreting results
Arrays are compared by position by default. Comparing ["red","blue"] with ["blue","red"] therefore reports changed positions. This is useful for ordered steps, ranked results, and timelines.
Turn on Ignore array order only when position has no meaning for your data. This option applies to arrays at every nesting level and compares them as multisets: duplicate counts still matter. ["red","red"] is not the same as ["red"].
When object arrays are reordered and their values also change, this mode reports unmatched objects as removed and added. It does not infer identity from an ID field. For a record-by-record audit, first produce two objects keyed by your application's stable ID, then compare those objects.
Ignore a known volatile field
If a timestamp changes on every request, enter its JSON Pointer in Ignore paths, one path per line:
/meta/updatedAt
/requestId
An ignored path removes that entire subtree from the comparison. Pointers are exact paths, not wildcard expressions or JSONPath filters. A slash inside a property name is written as ~1, and a tilde as ~0. For example, the key a/b at the root has pointer /a~1b.
Array paths refer to each original input's indexes. Ignoring /items/0 does not mean “ignore the record with ID 0.” Keep the ignore list short and review it with the result; otherwise it can hide the change you intended to investigate.
Read and export the report
The result distinguishes additions, removals, changed values, and type changes. It includes a readable path and a JSON Pointer so you can locate a field without searching the whole response.
Copy or download the JSON report when you need to attach it to a bug report. The interface and export retain at most 1,000 difference entries or a 6 MB report, whichever limit is reached first. A limited report explicitly says it is incomplete while showing the total count. Reports use compact JSON to avoid expanding deeply nested values with indentation. Narrow the input to the relevant subtree before sharing a large investigation.
Changing either input or comparison options invalidates the old result. Run Compare again before exporting. Try example fills the inputs but does not run a comparison for you.
Diagnose a failed comparison
- Invalid JSON: inspect the first reported location. A trailing comma, comment, or single-quoted string needs correction in the source.
- HTML instead of JSON: check the HTTP status and Content-Type. A sign-in page or gateway error can arrive where a JSON body was expected.
- Duplicate keys: fix the producer. Keeping only the last occurrence can hide conflicting values.
- Numeric precision: identifiers beyond JavaScript's safe integer range should be strings. The core tools reject unsafe integers, number literals requiring additional precision, and negative zero instead of silently changing them. Browser parsing cannot act as an arbitrary-precision audit.
- Too much input: each side is limited to 1 MB of UTF-8 JSON and nesting depth 100. Generated paths must fit within 8,192 UTF-8 bytes; a longer path is rejected. A comparison can be cancelled and has a time limit; it does not promise unlimited file processing.
Turn the finding into a regression check
Keep the smallest failing before/after pair. Record the array rule and ignored paths alongside it. Then encode the expected contract in a JSON Schema or an application test.
A difference report describes changed data; it is not an executable update document. If you need a patch endpoint, see the separate JSON Patch and Merge Patch guide.