Skip to content
OddsockLocal
Local
Source text
{
  "color": "red",
  "count": 2
}
1 wordsRuns in this browser. Nothing is uploaded.

How to use

  1. Paste the original JSON into Source text.
  2. Paste the revised JSON into Compare with, or choose a second file.
  3. Read the patch. A minus marks a removed line. A plus marks an added line.
  4. Use the two columns on screen: struck-through lines on the left, added lines on the right.

What is JSON diff?

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.

Read more

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.

Use cases

  • An API review compares a fixture with a live response and ignores the fact that the server wrote the keys in another order.
  • A release check confirms two configs match once keys are sorted, because the patch has no hunk.
  • A reviewer changes count from 2 to 3 and wants that line, and only that line, marked.
  • Someone debugging a client sees color flip from red to blue as one removal and one addition.
  • A contract test stores both payloads and reads the patch instead of a full-file mismatch.

Same keys, count changed

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.

Why use Oddsock

Sorting before the patch means the lines marked added or removed are value changes, which is the comparison that matters for two JSON writers.

Related tools

Using this tool

No. Both documents are sorted before the text diff. {"count":2,"color":"red"} against {"color":"red","count":2} has no added or removed lines.