Convert XML to JSON
Paste XML, or drop a .xml file, and download it as pretty-printed JSON. Nothing is sent anywhere.
Convert XML to JSON
Drop your XML file here
Up to 20MB per file. Stays on this device.
Nothing is sent anywhere. Turn off your Wi-Fi and this page still works - try it.
How it works
- Drop or choose a .xml file, or paste XML directly into the text box.
- Review the pretty-printed JSON preview.
- Download the result as a .json file.
Input
<order id="1">
<item>Coffee</item>
<price>4.50</price>
</order>
Output
{
"order": {
"@id": "1",
"item": "Coffee",
"price": "4.50"
}
}An attribute becomes an "@" key; child elements become their own keys.
Frequently asked questions
Is my XML sent anywhere?
No. Pasted XML and uploaded files are both read and converted entirely on your device, using your browser’s own XML parser - nothing is sent to a server. Turn off your Wi-Fi after the page loads and it still works. This page loads 11KB of JavaScript, gzipped - about what your browser's network tab will show for this page's own scripts.
How are attributes and text represented in the JSON?
Each attribute becomes a key prefixed with @ - <item id="5"> becomes "@id": "5". An element’s own text (outside its child elements) becomes a #text key when that element also has attributes or child elements; an element with only text becomes a plain JSON string. The document’s root element becomes the single top-level key of the result.
What happens to repeated elements?
Sibling elements sharing the same tag name become a JSON array, in the order they appear - <items><item>A</item><item>B</item></items> becomes {"item": ["A", "B"]}. A tag that appears only once stays a single value, not a one-item array.
Are numbers and true/false converted to their own JSON types?
No, on purpose. XML has no type system of its own, so every value - element text and attribute values alike - stays a JSON string. Guessing types silently changes data a visitor didn’t ask to change: a ZIP code like 00501 auto-converted to the number 501 loses its leading zero. This tool never does that.
What if my XML has a <!DOCTYPE> declaration?
It’s refused with a clear message rather than parsed. A can define custom entities, and resolving those safely and identically across every browser isn’t something this tool can guarantee - refusing the whole document up front closes off that risk rather than relying on it never coming up. Remove the line (most real-world XML - API responses, config files, RSS - doesn’t have one) and try again.
What if my XML has a syntax error?
You’ll get a plain-English error naming the problem instead of a converted file, or a silent blank result. Fix the tags at that spot and try again.
Files are processed locally in your browser and never uploaded. Read more on the privacy page.