XML to JSON Converter
Convert XML into JSON — the format most modern APIs and programs prefer. Paste an XML document and the converter turns elements into JSON objects, repeated elements into arrays, and attributes into @-prefixed keys. It runs entirely in your browser, so your data is never uploaded anywhere.
How to use this converter
Paste your XML and press 'Convert to JSON'. The JSON appears below, formatted with indentation — press Copy to copy it. If the XML is invalid, the tool shows the error instead of guessing.
Formula
Each XML element becomes a JSON object:
XML is still everywhere — RSS feeds, sitemaps, old APIs, Office files — but JSON is easier to work with in code. Converting by hand is slow and error-prone, especially with nested elements. This converter handles nesting, repeated tags and attributes, and tells you plainly if the XML is broken.
XML → JSON — examples
| From | Equals |
|---|---|
| {"name": "Ali"} | |
| 12 | {"a": {"b": ["1", "2"]}} |
| {"item": {"@id": "1", "#text": "x"}} | |
| {"empty": ""} |
Frequently asked questions
How do I convert XML to JSON?
Paste the XML above and press 'Convert to JSON'. The result appears formatted — press Copy to copy it.
How are attributes handled?
Attributes become keys with an @ prefix:
What happens with repeated elements?
They become a JSON array: two
What if my XML is invalid?
The converter shows the error message instead of guessing — fix the XML (usually an unclosed tag) and try again.
Is my data sent anywhere?
No. The conversion runs entirely in your browser — your data never leaves your device.