What does this tool do?
This free XML to JSON converter turns an XML document into clean JSON as you type, and converts JSON back to XML with the reverse toggle. It runs entirely in your browser — nothing you paste is uploaded — so it is safe for config files and API payloads, and it works offline once loaded.
How XML maps to JSON
XML and JSON do not have a one-to-one structure, so this tool uses the widely-adopted convention:
- Attributes become keys prefixed with
@. So<user id="7">becomes{ "user": { "@id": "7" } }. - Element text becomes the value directly when an element has no attributes or children; otherwise it is stored under a
#textkey. - Repeated sibling tags with the same name are collected into a JSON array automatically.
- Nested elements become nested objects, mirroring the document tree.
The reverse direction (JSON to XML) reads the same convention back: @ keys become attributes, #text becomes element text, and arrays become repeated tags.
How to use it
- Paste XML on the left; the JSON appears live on the right.
- Pick 2 spaces, 4 spaces, or tabs with the Indent control.
- Copy the result or Download a
.jsonfile. - Malformed XML shows a clear parse error so you can fix it fast.
XML vs JSON
XML is verbose and document-oriented, with attributes, namespaces and a rich schema ecosystem — still common in enterprise systems, SOAP APIs, RSS/Atom feeds, and office file formats. JSON is lighter and maps directly onto the data structures of modern programming languages, which is why most web APIs moved to it. Converting XML to JSON is a frequent step when modernizing an integration or pulling a legacy feed into a JavaScript app.
Common uses
- Convert a SOAP or legacy API's XML response into JSON for a modern front end.
- Turn an RSS/Atom feed into JSON for processing.
- Inspect a dense XML config by viewing it as structured JSON.
FAQ
How are XML attributes represented in JSON?
Each attribute becomes a key prefixed with @. For example <user id="7"> becomes { "user": { "@id": "7" } }.
What happens to repeated tags?
Repeated sibling elements with the same name are collected into a JSON array automatically.
Is my data uploaded?
No. Conversion runs entirely in your browser; nothing you paste leaves your device.
Why do I get a parse error?
XML must be well-formed: every tag closed, one root element, and attribute values quoted. The error message points to the problem.