Transform XML data structures into clean, formatted JSON instantly.
How It Works
This converter uses your browser's built-in DOMParser to parse XML into a document tree, then recursively walks each node to build a JSON object. Element nodes become object keys with their tag names. Text content is captured as the element's value, while attributes are stored in an @attributes property. When multiple sibling elements share the same tag name, they are automatically grouped into a JSON array. The result is a clean, valid JSON structure that preserves your original XML hierarchy and data relationships.
Frequently Asked Questions
How do I convert XML to JSON?
Paste your XML data into the input field, click the Convert button, and the tool will instantly parse the XML structure and output equivalent JSON. Attributes are preserved as properties, nested elements become nested objects, and repeated sibling elements are converted to arrays.
Does this XML to JSON converter handle attributes?
Yes. XML attributes are converted into a dedicated attributes object within the JSON output. You can also enable the flat mode option to merge attributes directly into the parent element for a simpler structure.
Is my XML data safe with this converter?
Absolutely. This tool runs entirely in your browser using JavaScript. Your XML data is never sent to any server or uploaded anywhere. All processing happens locally on your device.