XML to JSON
Paste XML, get valid JSON. Elements, attributes (@ prefix), repeated tags and nesting are converted entirely in your browser.
XML to JSON
Paste any well-formed XML. Attributes become @attributes and repeated elements become arrays.
Your converted JSON appears here
Paste XML above, then press Convert to JSON. The formatted JSON output will appear here.
How It Works
Three simple steps to valid JSON.
Paste your XML
Drop any well-formed XML document into the editor.
Convert instantly
Elements, attributes and nesting become JSON.
Copy or download
Copy the JSON or download it as a converted.json file.
FAQ
Common questions about the XML to JSON converter.
How does the XML to JSON converter work?
It uses the browser’s built-in DOMParser to parse XML, then recursively walks the DOM to build a JSON object, preserving elements, text, attributes and nesting.
Are XML attributes included in the JSON output?
Yes. Attributes are included as properties prefixed with @ (e.g. "@attributes") so they can’t be confused with child elements.
Is my data uploaded to a server?
No. All processing happens entirely in your browser. Your XML never leaves your device.
Can I toggle pretty-printing?
Yes. A pretty-print toggle lets you switch between compact or indented 2-space JSON output.
How are repeated elements handled?
Repeated child elements with the same tag name are grouped into a JSON array automatically.
Can I download the JSON as a file?
Yes. Use the Download button after converting to save the output as a converted.json file.