Format Code Now
/

JSON Compare

FV-07

Paste two JSON documents in the one box, with a line containing only ===== between them. You get a list of added, removed and changed paths. It compares the data, not the spacing or the key order.

Runs in your browser. Nothing is uploaded.

Two JSON documents, separated by a line containing only =====

Differences

How to use it

  1. Paste the first JSON document into the input box.
  2. On a new line type ===== on its own, then paste the second document below it.
  3. Press Compare. Each difference appears on its own line with its path.
  4. Turn on Ignore array order if the order of array items does not matter, or turn off Ignore key order to also see reordered keys.
  5. Choose dot or JSONPath style for the paths, then copy the result.

What counts as a difference

The comparison works on the data. Spacing never counts, 1.0 equals 1 and 1.50 equals 15e-1, and a string written with escapes equals the same string written plainly. Numbers are compared exactly, so 12345678901234567890 and 12345678901234567891 are different. A value that changes type, for example 1 to "1", is reported as changed. Each line starts with + for added, - for removed or ~ for changed.

Key order and array order

Object keys have no order in JSON data, so Ignore key order is on by default. Turn it off to also list objects whose keys appear in a different order. Arrays compare item by item by position. With Ignore array order on, items are matched by their whole value instead, so a changed item shows as one removed and one added rather than as a change inside it, and repeated items are counted.

Limits

This lists differences by path in input order. It does not create a JSON Patch document and it does not match array items by an id field. Long values in the output are cut after 120 characters with a note of how many were left out. Each side must be valid JSON, and an error names which side it is on and shows the line in your input box.

Error messages and what to do

MessageWhat it meansFix
Separator not found. Put a line with only ===== between the two texts.The input has no line made only of five equals signs.Add ===== on its own line between the two documents.
Found 2 lines with only =====. Use exactly one, between the two JSON documents.The input contains more than one separator line, so it is unclear where the second document starts.Keep a single ===== line.
First JSON (above =====): Expected a string key at line 1, column 8The first document is not valid JSON. The message names the side and the line and column in your input box. The second document gets the same form with Second JSON (below =====).Fix the JSON at that position. Check the Validate action of the JSON Validator if the cause is unclear.

Questions people ask

How do I compare two JSON files online?

Paste both documents into the one box with a line containing only ===== between them, then press Compare. You get the paths that were added, removed or changed. Nothing is uploaded.

Does JSON compare care about key order?

Not by default. Two objects with the same keys and values in a different order are equal, because key order carries no meaning in JSON data. Turn off Ignore key order if you also want reordered keys listed.

Can I ignore the order of array items?

Yes. Turn on Ignore array order. Items are then matched by their full value, so the same items in a different order are equal. A changed item appears as one removed and one added item instead of a change inside it.

Does 1.0 equal 1 in the comparison?

Yes. Numbers are compared by value, exactly and without rounding, so 1.0 equals 1 and 1.50 equals 1.5. Two long integers that differ in the last digit are reported as different, since no precision is lost.

What is the difference between a JSON diff and a text diff?

A text diff compares lines, so reformatting the file marks every line as changed. A JSON diff compares the data and reports paths, so spacing and key order do not matter. For line by line comparison use the Text Diff tool.

Does it produce a JSON Patch?

No. The output is a readable list of added, removed and changed paths, not an RFC 6902 patch you can apply. Paths use dot style or JSONPath style, as you choose.

About this tool

Compares the data, not the text. Whitespace never counts, 1.0 equals 1, and a string with escapes equals the same string written plainly. Numbers are compared exactly, with no rounding. With "Ignore array order" on, items are matched by their whole value, so a changed item shows as one removed and one added rather than as a change inside it. Differences are listed by path in input order; this tool does not produce a JSON Patch.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.