Convert JSON to XML and XML to JSON.
Translating between JSON and XML is inherently "lossy". They are not simply two ways to write the exact same thing; they have fundamentally different structural paradigms.
JSON is built on Data Structures (Objects and Arrays), whereas XML is built on Documents (Nodes and Attributes).
In XML, a node can have Attributes alongside its text value: <user id="1">Alice</user>.
JSON has absolutely no concept of attributes. To represent this XML in JSON, you are forced to invent a non-standard convention, such as prefixing attribute keys with an underscore or an at-symbol: { "@id": "1", "#text": "Alice" }. When converting JSON back to XML, the converter must explicitly know your chosen convention to rebuild the attributes properly.
In JSON, Arrays are explicit: "users": ["Alice", "Bob"].
In XML, Arrays do not exist. To represent a list, you simply repeat the same XML element consecutively: <user>Alice</user><user>Bob</user>.
The fatal flaw occurs when converting XML back to JSON. If the XML parser only sees a single <user> element in the document, it has no mathematical way of knowing if it was intended to be an Array of length 1, or just a standard Object. This ambiguity leads to frequent crashing bugs in API integrations when a usually-plural list happens to only return one item.
Why is converting XML containing attributes to JSON problematic?