Converting between XML and JSON in both directions
Pick a direction, paste the source, and you get the converted output, its size and a list of what this particular conversion lost. The default sample contains a comment, two same-name siblings and an empty element, so you can see how losses are reported straight away.
XML parsing goes through the browser DOMParser, and the mapping follows the table above: attributes become keys prefixed with @, loose text becomes a #text key, and repeated siblings become an array. The important premise is that this conversion is not lossless. XML carries comments, processing instructions, CDATA markers and the position of mixed text, and a JSON object has nowhere to put them.
Going the other way, numbers and booleans turn into text and a one-item array flattens into a single element. As of October 2026 there is no single standard XML-to-JSON mapping, so every tool picks its own rules and another converter may disagree with this one. Schema validation and XSLT transformation are not supported.
Frequently Asked Questions
No. Comments, processing instructions, the CDATA distinction and the position of mixed text are all lost, and a one-item array flattens to a scalar. The output panel lists what this conversion dropped and how many of each.
Attributes move to keys prefixed with @, so identical names never collide. XML element names cannot start with @, which keeps the two apart.
It does not. XML values carry no type, so a string that looks like a number cannot be told apart from a real number, and everything is read as a string.