Glossary

Lossy conversion

A conversion where the output cannot express everything the input could.

A conversion is lossy when the target format has no way to represent something the source format could. It is not a bug and usually not an error. Nothing fails, the output is valid, and the missing information simply is not there any more.

The common cases are structural. XML distinguishes attributes from child elements and JSON does not, so converting XML to JSON has to encode attributes as ordinary keys. YAML comments disappear when converting to JSON, because JSON has no comment syntax. A Markdown table cannot express a merged cell, so an HTML table using colspan comes out misaligned.

The practical rule is to keep the richer format as your source of truth and treat the converted form as generated output. Converting back rarely restores what was dropped: a round trip through a less expressive format is not reversible just because both directions are available.