XML to JSON Converter
Convert XML to JSON (and back) entirely in your browser. Attributes, nested elements, repeated tags and text are mapped automatically. No upload.
Convert
How it works
- Paste XML (or JSON in reverse mode) and click Convert.
- Pick XML → JSON or JSON → XML from the mode selector.
- Attributes map to
@attributes, repeated tags become arrays. - Nothing is uploaded — conversion runs in your browser.
About XML ↔ JSON
XML and JSON represent the same tree of data with different syntax, so moving between them is mostly a question of convention: where do attributes go, and how do repeated siblings become arrays? This tool uses the widely adopted convention that attributes live under @attributes and repeated tags become arrays, which keeps the conversion predictable and reversible.
Use it to bridge an XML API response into JSON your code consumes, or to emit XML from a JSON document. For round-tripping, the JSON view is the source of truth; re-converting it to XML produces a structurally equivalent document, though attribute ordering may differ from the original.
The XML → JSON mapping
The converter parses the XML with the browser's DOM parser, then walks the resulting tree. Attributes surface as an `@attributes` object, text content as `#text`, and child elements as nested objects. When several children share a tag, they are gathered into an array so the structure round-trips predictably.
Namespaces and prefixes are preserved verbatim as tag and attribute names — the tool does not rewrite them. If your document uses default namespaces, expect the prefix to appear in the JSON keys; this keeps the mapping lossless rather than opinionated.
JSON → XML direction
In the reverse direction, each object becomes a parent element containing its properties as child elements; an array repeats the child element once per item under the array's key. Scalars become text content, and `null` is emitted as an empty element.
The root element name is taken from the top-level object's single key when there is one, or from the configurable root name otherwise. This is a structural subset mapping — it does not model XML attributes on the JSON side, CDATA sections, or processing instructions.
Privacy and limits
All parsing happens locally: the XML or JSON never leaves the page and there is no upload. Large documents take as long as the browser needs but stay on your machine.
Because the mapping is intentionally simple, very large or deeply nested XML may produce verbose JSON. Treat the output as a faithful structural translation, not a semantically typed document.
Frequently Asked Questions
How are XML attributes and repeated tags handled?
Can it convert JSON back to XML?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.