Equivl

Compare two JSON, YAML, TOML or XML documents by the data they hold

A structured data diff parses two documents and compares the values they hold, path by path, so key order, indentation, quoting and comments never count as differences while a changed port, a number that became a string or a new key does.

Compare two data files

Runs entirely in your browser; nothing is uploaded.

What counts as a difference

Both documents are parsed, and every leaf value is compared at its path, such as servers[2].port. Each difference is listed as one row that says what kind of change it is:

Key order, whitespace, quoting style and comments are never differences: none of the four formats gives them a meaning. The score is the share of values that match, out of every value path on either side. The list shows the first 500 rows; the verdict and the score always cover every path.

Numbers are compared as written

JavaScript's own JSON reader, and the popular YAML readers, turn 9007199254740993 into 9007199254740992 silently, so two IDs that differ in the last digit would compare equal. Equivl keeps any number a 64-bit float cannot hold exactly as the digits written, and compares those exactly. 1 and 1.0 are the same number. One limit: TOML's parser gives no source text, so a TOML float with more digits than a float holds is compared rounded, and the result is flagged and capped at near-equivalent.

A match across formats is near-equivalent at best

A JSON file and the YAML it was converted from can hold the same values, and Equivl will say so. It will not call them equivalent: they were read by two different parsers, and each format has types the other lacks, such as TOML dates. The same holds for a match that needed a number tolerance or needed list order ignored. Those options exist and are off by default, and any match they produce is reported as near-equivalent with the reason named.

Where it stops instead of guessing

YAML is read as YAML 1.2

In YAML 1.2, no is the string "no". Tools built on YAML 1.1, such as PyYAML, read it as false, which turns Norway's country code into a boolean. When a difference is exactly that pair, the row says so. Anchors and merge keys (<<: *defaults) are expanded before comparing, as any YAML reader would expand them, and a custom tag such as !Ref is kept as part of the value rather than dropped.

Limits

Questions

Are my files uploaded anywhere?

No. Parsing and comparison run entirely in your browser, and the documents you paste never leave the page.

Does key order matter?

No. JSON, YAML and TOML give the order of keys no meaning, and XML gives none to the order of attributes, so reordering them is never reported as a difference. List order does matter by default, and there is an option to ignore it.

Can I compare a JSON file against a YAML file?

Yes. JSON, YAML and TOML can be compared with each other, and every differing path is listed. A perfect match across formats is reported as near-equivalent rather than equivalent, because the two were read by different parsers. XML is compared only with XML.

Why does it refuse a file with a duplicate key?

Because the file has no single meaning. Some parsers keep the first value and others the last, so any comparison would depend on which one you happened to use. The error names both lines so you can remove one.

Related