JSON diff
Compare two JSON values and list the keys and array items that were added, removed or changed.
Runs in your browser. Your input is not uploaded.
Loading the tool…
What it does, how to use it, and questions
What it does
A line diff of two JSON files reports every key that moved, even when the data is the same. This comparison walks the values: objects are matched by key, and arrays are matched by index.
Both texts are parsed with JSON.parse. Invalid JSON is reported with the side, the line and the column.
How to use it
- Paste the original JSON on the left and the new JSON on the right.
- Read the added, removed and changed paths.
- Copy the list if you want it in a review.
Example
Input
{"name":"Ada","roles":["admin"]}Output
changed $.roles[1] added $.active
Things to watch for
- Array items are compared by position. Inserting an item at the start marks every later item as changed.
- Key order is ignored. A formatter that only sorts keys will show no changes.
- Numbers bigger than 2^53 are rounded by
JSON.parsebefore the comparison, on both sides.
Questions
- Why does a line diff show changes when this does not?
- The objects have the same keys and values in a different order. JSON does not treat key order as meaningful, and this tool does not either.
- How are arrays compared?
- By index.
["a","b"]against["b"]is a change at[0]and a removal at[1], not a deletion of"a". - Can I compare YAML?
- Convert both sides to JSON with the YAML tool, then paste them here.
- Is either side uploaded?
- No. Both are parsed in this page.