About the JSON Diff
A text diff compares lines, so reordering the keys of an object or re-indenting a file marks everything as changed. This tool parses both documents and compares the data. Each difference is listed with its path, such as $.owners[1].role, and one of four kinds: added, removed, changed (same type, other value) and type changed (for example the string "30" became the number 30). Numbers are compared by value, so 1, 1.0 and 1e0 are equal.
Arrays are aligned with a longest common subsequence over equal items. When one item is inserted at the start of a list, the result is a single added entry and not a change on every following index. Items that differ at the same place are compared with each other, so a changed field inside an array of objects is reported as $.items[3].price. With Ignore array order, arrays are compared as multisets: [1, 2, 3] equals [3, 1, 2], and duplicates are counted. Treat null and a missing key as equal helps with APIs that leave out empty fields.
The output is a text report, a JSON list of the differences, or a JSON Patch (RFC 6902): an array of add, remove and replace operations with JSON Pointer paths. Applied in order to the original, the patch gives the changed document; array indexes already account for the operations before them. With Ignore array order the patch appends new items at the end (/-), so the result matches the changed document in content, not in order. Both documents stay in your browser.
How to use it
- Paste the original JSON on the left and the changed JSON on the right.
- Read the list of differences: kind, path, old and new value.
- Turn on Ignore array order if the order of list items does not matter.
- Choose text report, JSON Patch or JSON list, then copy or download it.