Compare JSON Documents and Find What Changed
When an API response, configuration file, or test fixture changes, a text diff can show many lines of noise from indentation or formatting. A structural JSON comparison parses both documents and reports changes in their values and shape: fields added or removed, values changed, and values whose type changed. RomitJSON shows each difference with its JSON path and the value from JSON A and JSON B.
Paste or open the earlier document as JSON A and the newer document as JSON B, then select Compare JSON. Choose how arrays should be compared before running the comparison if position or object identity matters.
How to Compare Two JSON Files
- Enter the first document in JSON A and the second in JSON B. You can paste the text, use Open JSON A and Open JSON B, or drop a JSON file into either input.
- Select Compare JSON. Both documents must contain valid JSON.
- Review the added, removed, changed, and type-changed counts, then inspect the paths and old and new values.
- Switch between Side by side, Unified diff, and Changes only to read the report in the format that suits the review.
- Copy the report or download it as a text file if you need to save the findings.
Example: Find a Changed Value by Path
Suppose JSON A contains "price": 499 and JSON B contains "price": 599. The comparison reports a changed value at $.price, with the old and new values shown separately. A nested change might appear at a path such as $.products[1].price, which points to the price field in the second item of the products array.
JSON A: { "product": { "price": 499 } }
JSON B: { "product": { "price": 599 } }
Difference: changed at $.product.price
The comparison follows the JSON structure, so whitespace and object property order alone do not count as changes. JSON objects are unordered collections, while arrays are ordered sequences in the JSON data model; this tool therefore compares arrays by position unless you choose another array option. See RFC 8259 for the JSON data format.
Choose How Arrays Are Compared
Array comparison depends on what the items represent. If each position has meaning, keep the default comparison by index. If items may move, choose a mode that matches them by content or identifier.
| Option | How it compares arrays | Use it when |
|---|---|---|
| Default | Compares items at the same index | Position is meaningful, such as steps in an ordered workflow |
| Ignore array order | Treats each array as a multiset; duplicate item counts still matter | The same items may appear in a different order |
| Match array objects by key | Pairs object items using a chosen identifier, such as id | Records can move but have a stable, unique identifier in both arrays |
For identifier matching, every item in both arrays needs that key with a unique, non-null primitive value. If an ID is missing, repeated, null, or an object, the tool warns you and compares that array by index instead. Check the warning before interpreting the paths: when records move, their indexes can differ between JSON A and JSON B.
Ignore Fields That Change on Every Run
Some fields, such as a generated timestamp or request ID, can obscure the changes you want to review. Enter one JSONPath per line in Ignore exact JSONPaths, for example $.metadata.updatedAt. The selected location and its nested values are excluded from the comparison. Use a specific path; this field is for paths to ignore, not a general search or wildcard query.
Understand the Difference Report
- Added: a property or array item appears in JSON B but not JSON A.
- Removed: a property or array item appears in JSON A but not JSON B.
- Changed: a value differs while its JSON type stays the same.
- Type change: a value changes from one JSON type to another, such as a number becoming a string.
Difference paths identify where a change occurs. If a path differs between the two documents, the report can show the JSON A and JSON B paths separately. The counts are per reported difference; type changes have their own count and are also included in the total. The tool shows the first 1,000 differences, so a capped report may not include every change in a very different pair of documents.
JSON Compare, JSON Validator, and JSON Formatter
A JSON comparison tool answers “what changed between these two documents?” A JSON Validator checks whether one document follows JSON syntax. A JSON Formatter adds indentation to make JSON easier to read. Comparing valid JSON is useful when the structure matters; validating first helps when either input has a syntax error.
Input Limits and Privacy
Each input can be up to 50 MiB. The comparison runs in your browser, and deeply nested data is limited to 500 levels. Large files can take more time and browser memory to process. The result is capped at 1,000 differences; copy or download the report if you need a saved review.
Frequently Asked Questions
Does JSON object key order affect the comparison?
No. Object properties are compared by key, so changing their order or reformatting whitespace does not create a difference.
Are JSON arrays compared by position?
Yes, by default. Choose Ignore array order to compare items as a multiset, or match arrays of objects by a unique identifier when records can move.
What happens when array IDs are missing or duplicated?
The tool reports that matching is ambiguous and falls back to comparing that array by index. Add a unique, non-null primitive identifier to every item in both versions for identity-based matching.
Can I ignore timestamps or other changing fields?
Yes. Add a specific JSONPath, such as $.metadata.updatedAt, in the ignore-path field. The selected path and its nested content are omitted from the comparison.
Why can’t the tool compare my JSON?
Check that both inputs are valid JSON and no larger than 50 MiB. If an input is deeply nested, it may also exceed the 500-level comparison limit. Use the JSON Validator to check syntax errors.
Does JSON Compare modify either document?
No. It reports differences and lets you copy or download the report; it does not merge or rewrite JSON A or JSON B.
Related JSON Tools
Use the JSON Validator to check syntax, the JSON Viewer to explore nested structures, the JSON Editor to make changes, or the JSON Schema Validator to check data against a defined structure.