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.
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:
- changed: the same type with a different value, such as
8080to8081. - type changed: a number that became a string (
5to"5") is its own kind, because it can break whatever reads the file and is easy to miss by eye. - added and removed: a key or list item present on only one side.
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
- A document that does not parse is not compared at all. The error is shown with its line and column, and no verdict appears. Two broken files never compare equal.
- A duplicate key stops the comparison. Parsers disagree about which of the two values wins, so the document has no single meaning to compare.
- XML is compared only with XML. XML can be mapped to JSON in several accepted ways, and picking one would be a guess. Inside XML every value is text, since XML has no numbers.
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
- Lists are compared by position unless you choose to ignore their order, so an item inserted at the front of a list shows every later item as changed.
- Line context for a difference is available for JSON and YAML, not for TOML or XML.
- In XML, child elements are grouped by name: the order of elements that share a name is compared, but not the order of differently named siblings, so a schema where that order carries meaning needs a text diff as well.
- Mixed content such as
<p>Hello <b>x</b> world</p>compares its text and its child elements separately, not their interleaving.
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.