Text

Changes

Pretty-prints each side with two spaces, then compares the lines. Spacing differences disappear. A change in key order still shows, because JSON.stringify keeps the order it was given.

About this tool

Two JSON documents can differ only in spacing or only in key order. This page reprints each side with a two-space indent, then runs a line diff, so spacing drops out and a moved key still appears.

{"b":1,"a":2} against {"a":2,"b":1} is reported as a change because the lines move. If order were ignored, the data would be the same. This page does not ignore order.

Invalid JSON on either side stops the comparison. The marks are + and -, as in the text diff. The JSON stays in the browser.

How to use it

  1. 1

    Paste JSON on the left and on the right. Both sides must be valid. Invalid JSON on either side is rejected.

  2. 2

    Each side is written with a two-space indent before the line diff. Added lines are marked +, removed lines -. {"b":1,"a":2} against {"a":2,"b":1} is reported as a change because the lines move.

  3. 3

    This is not a semantic comparison that ignores key order. Values can match and the diff still shows the move. Nothing is uploaded.

What it accepts

Each side is parsed as JSON and then written again with JSON.stringify and a two-space indent. That reprint removes spacing differences before the line diff runs. Key order is the order JSON.stringify keeps, so swapping keys still moves lines even when the values match. Example: {"b":1,"a":2} against {"a":2,"b":1} is reported as a change, although the data would be the same if order were ignored. The marks are the same as the text diff: + for an added line, - for a removed line. This is not a semantic comparison that ignores key order. Invalid JSON on either side is rejected.

Where your data stays

The two JSON texts are pretty-printed in this tab and then compared as lines. MegaToolkit does not receive either side. A spacing-only difference disappears after the two-space reprint, while a reordered key still shows because the lines move. Closing the tab drops both sides.

Questions

Why does reordering keys show as a change?

JSON.stringify keeps the key order it was given. {"b":1,"a":2} and {"a":2,"b":1} print on different lines, so the line diff reports a change even though the values match.

Do spaces between keys matter?

No. Each side is pretty-printed with a two-space indent before the diff, so insignificant spacing disappears.

What if one side is invalid?

Invalid JSON on either side is rejected. Both sides must parse before a diff is shown.

Is this a semantic deep equal?

No. It is a line diff of the reprinted JSON. It does not ignore key order. The same + and - marks as the text diff are used. Nothing is uploaded.