How XML becomes JSON
Convert a document
- Paste a complete XML document.
- Select Convert to JSON.
- Inspect name, attributes and the ordered content array.
- Copy the JSON and test it with the system that will consume it.
Mapping rules
Every element becomes { name, attributes, content }. Repeated children remain separate content entries and mixed text stays in its original order.
Namespace prefixes and xmlns declarations stay in tag and attribute names. The tool does not silently expand, remove or remap namespaces.
Security and fidelity limits
- DTD and entity declarations are rejected; no external resource is requested and XML is never rendered as HTML.
- Comments and processing instructions are omitted. Whitespace-only text between elements is omitted, while meaningful text and CDATA are preserved.
XML to JSON FAQ
Why is content an array?
An array can preserve the order of text and repeated child elements, including mixed content.
Are namespaces preserved?
Prefixes and namespace declaration attributes are preserved literally; no namespace-resolution policy is imposed.
Can it convert JSON back to XML?
No. Reverse conversion has different escaping and structure decisions and is outside this page.