{
"color": "red",
"count": 2
}JSON diff parses both documents, sorts keys at every level, pretty-prints them, and then diffs the text. Key order drops out. {"count":2,"color":"red"} against {"color":"red","count":2} produces a patch header and no hunks: nothing added, nothing removed. Change count from 2 to 3 and the patch marks the old count line removed and the new count line added, with color left as a shared line.
Both sides have to be JSON. The second document goes in Compare with, or you choose a second file. An empty second box fails with Unexpected end of JSON input, because there is nothing to parse. The result is a unified patch. On screen the left column is the original, with removed lines struck through, and the right column is the revision, with added lines shown. Lines that start with a minus in the patch were removed. Lines that start with a plus were added.
Original: {"color":"red","count":2}. Compare with: {"count":3,"color":"red"}. A second pair with the same values and swapped key order shows the order-only case.
The count change is marked like this: @@ -1,4 +1,4 @@ { "color": "red", - "count": 2 + "count": 3 } The minus line was removed. The plus line was added. Swapped key order with count still 2 produces the file header and no @@ hunk.
Sorting before the patch means the lines marked added or removed are value changes, which is the comparison that matters for two JSON writers.
No. Both documents are sorted before the text diff. {"count":2,"color":"red"} against {"color":"red","count":2} has no added or removed lines.
count 2 against count 3 marks - "count": 2 as removed and + "count": 3 as added. The color line has a leading space in the patch, which means it stayed.
The revised side is parsed as JSON. Empty input throws Unexpected end of JSON input. Paste a second document, even {}.
Array order is preserved. Only object keys move. Swapping two array elements still shows as a change.
Text diff compares the characters you pasted. Key order shows up there as removed and added lines. This page sorts first.