When to use it
Useful for working with legacy APIs that still respond in XML (SOAP, RSS feeds, some webhooks), converting to the JSON that most modern languages handle more easily — and the other way around.
Convention used
There's no single universal standard for XML↔JSON conversion. This tool uses the most common convention: attributes become keys prefixed with @ (e.g. @id), the text of a childless element becomes a plain string, and repeated elements with the same name become an array.
A round-trip example
The XML <book id="7"><title>Dune</title></book> becomes {"book":{"@id":"7","title":"Dune"}}. A single child element shows up as a plain value, but two same-named elements become an array, so the JSON shape can vary with the number of items in the source XML.
What gets lost
XML comments and processing instructions have no JSON equivalent. The order between differently named elements may not be strictly kept either, and every value arrives as text, even when it looks like a number.
Frequently asked questions
Why does the JSON need a single root key to convert to XML?
Because an XML document always has exactly one root element — that root key's name becomes the generated XML's main tag.
Are XML namespaces supported?
Namespaces are treated as part of the tag/attribute name, with no special handling — for advanced cases with complex namespaces, the result may need manual adjustment.
What happens with text mixed with elements?
In XML like <p>Hello <b>world</b></p>, text and elements share the same node. Such mixed content has no natural JSON form and can lose its exact order, so avoid converting formatted-text documents such as XHTML.