Paste XML into the left pane and click Convert. The matching JSON appears on the right, ready to copy. Nothing is uploaded - the conversion happens in your browser.
XML to JSON Converter
Paste an XML document into this XML to JSON converter and it returns the same data as formatted JSON. Element names become keys, attributes are prefixed with @_, and repeated tags become arrays. Everything runs in your browser, so the XML never leaves your device and no account is needed.
What the converter preserves
The browser's own DOMParser reads your XML, so the structure survives the round-trip the way most JSON consumers expect:
- Attributes are kept, not dropped. An element like
<book id="1">becomes"book": { "@_id": "1" }, so downstream code can still read the id. - Mixed content stays addressable. When an element holds both attributes and text, the text lands under a
#textkey. - A single child tag becomes an object; two or more siblings with the same tag name become a JSON array, which is what list-shaped data needs to iterate cleanly.
When to reach for it
Use it when a downstream service, config loader, or API accepts JSON but you were handed XML - a legacy SOAP response, an RSS item, an Android layout, or a Maven POM. Toggle Compact output when you want a single minified line to drop straight into code.
Malformed markup is reported, not guessed
Because the parser is the browser's own DOMParser, malformed markup is reported back to you instead of producing silent, wrong output. Fix the highlighted issue and convert again.
Frequently Asked Questions
Is my XML uploaded to a server?
No. The conversion uses the browser's built-in DOMParser and runs entirely on your device. The XML you paste is never sent anywhere, which makes the tool safe for internal or confidential data.
How are XML attributes represented in the JSON?
Each attribute becomes a key prefixed with @_ on the element object. For example, <user role="admin"> converts to "user": { "@_role": "admin" }. This keeps attributes distinct from child elements.
What happens when a tag repeats?
Two or more sibling elements with the same tag name are grouped into a JSON array. A single occurrence stays an object, so simple structures do not get wrapped in arrays unnecessarily.
Where does element text go?
A text-only element becomes a plain string value. When an element has both attributes and text, the text is stored under a #text key alongside the @_ attribute keys.
What if my XML is invalid?
The output pane shows the parser error message instead of guessing. Correct the reported issue - a missing closing tag or an unescaped & is common - then convert again.
Can it convert JSON back to XML?
This page only converts XML to JSON. For the reverse direction, see the related tools listed below the tool.