Data Tools
JSON Diff: Compare Two JSON Documents
Compare two JSON documents value by value: additions, removals and changes with full paths, ignoring key order and formatting, or output an RFC 6902 JSON Patch.
How to use JSON Diff: Compare Two JSON Documents
Paste the original JSON into A and the changed version into B, and the differences appear as you type. Choose a table of differences or a JSON Patch, and decide whether arrays are compared by index or as sets.
- Paste the original JSONPut the older version in Original JSON (A). Errors are reported with the line and column.
- Paste the changed JSONPut the newer version in Changed JSON (B). Key order and indentation do not matter.
- Pick the outputChoose Table of differences or JSON Patch (RFC 6902), set how arrays are compared and copy the result.
Reading the differences table
With the sample documents the counts read 4 differences: 1 added, 1 removed and 2 changed. $.age changed from 30 to 31, $.address.city from "London" to "Manchester", $.tags[1] ("beta") was removed and $.email was added. Unchanged values such as name and postcode are left out unless you tick Also list unchanged values. The comparison walks into nested objects and arrays, so only the exact paths that differ are listed, and key order and whitespace are ignored. A value that switches type, such as the number 1 becoming the string "1", is marked Type changed.
Arrays and JSON Patch output
Arrays are compared item by item by default, which suits lists where position matters. Choose Ignore order (as a set) to treat [1,2,3] and [3,2,1] as equal and list only items that are genuinely extra or missing. Switch the output to JSON Patch (RFC 6902) to get a list of operations, such as {"op": "replace", "path": "/age", "value": 31} and {"op": "remove", "path": "/tags/1"}; applying them to A in order produces B. Paths use JSON Pointer syntax, so /address/city means the city key inside address. JSON Patch output always compares arrays by index.
Accuracy and data handling
Keep the original data and spot-check fields, types and delimiters before using an important conversion. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I compare two JSON files?
Paste the old version into A and the new one into B. Every added, removed and changed value is listed with its path and its before and after values as you type.
Does key order count as a difference?
No. Objects with the same keys and values are equal whatever their key order and indentation. Only changed values and added or removed keys are reported.
How is a JSON diff different from a text diff?
A text diff compares lines of characters, so reformatting or reordering keys shows up as changes. A JSON diff parses both documents first and compares the data, so only real changes are listed.
Can I generate a JSON Patch?
Yes. Set Output to JSON Patch (RFC 6902) to get add, remove and replace operations that turn A into B, ready for an HTTP PATCH request or a JSON Patch library.
More Data Tools
Related toolsRemove duplicates from a list or JSON array and see how often each value repeats.
Turn CSV into a JSON array or JSON Lines with optional type detection
Turn JSON arrays, objects or JSON Lines into CSV you can preview and download
Trim spaces and remove blank rows, empty columns and duplicates from CSV.
Convert CSV or spreadsheet cells into Markdown, HTML or ASCII table code.
Convert file sizes and estimate how long a transfer takes at any speed.