XML to JSON Converter
Convert XML to JSON and back, with attributes and nested elements — 100% in your browser.
Attributes map to “@name”, mixed text to “#text”, and repeated tags to arrays.
About XML to JSON Converter
Paste XML and get JSON, or switch direction to turn JSON back into XML. Element attributes become keys prefixed with “@”, mixed text content becomes “#text”, and repeated child elements collapse into arrays — a predictable, round-trippable convention.
XML parsing uses the browser's built-in parser, which reports malformed XML, and the JSON-to-XML direction is generated locally. Nothing you paste is uploaded.
How to use XML ⇄ JSON
- Choose the conversion direction and paste a complete document or JSON value.
- Inspect attributes marked with @, text marked with #text and arrays produced by repeated XML child elements.
Limitations and common mistakes
XML and JSON have different data models. Attribute order, mixed content, namespaces and text formatting may not survive a round trip unchanged.
JSON property names are not always legal XML element names. Review the generated structure against the application consuming it; this is not an XSD validator.
The tool processes its input locally on your device. Read our privacy policy for analytics, storage and network details.
XML to JSON
<note id="1"><to>Tove</to></note>
{ "note": { "@id": "1", "to": "Tove" } }Attributes use “@”, repeated tags become arrays. Switch direction for JSON → XML.
Frequently asked questions
How are attributes represented?
Each attribute becomes a key prefixed with “@” (e.g. @id), so it's distinct from child elements and survives a round trip.
What about repeated elements?
Repeated child tags with the same name are grouped into a JSON array automatically.
Does it validate the XML?
Yes. The browser's XML parser reports malformed XML with an error message.
Is my data uploaded anywhere?
No. Both conversions happen entirely in your browser.
For related tasks, explore XML Formatter and JSON Formatter. Their guides explain the different inputs, assumptions and output formats.