XML to JSON Converter
Paste XML and get clean, valid JSON instantly. Nested and repeated elements are handled automatically.
Convert XML attributes and repeated elements
XML has attributes, text and repeated elements; JSON has objects and arrays. This converter makes those mapping rules explicit so you can inspect the result before using it in an API or export.
Paste well-formed XML with one root element.
Inspect attributes, text and repeated elements in the output.
Copy or download the JSON and validate the consuming application’s schema.
Before
<catalog><book id="1">JSON & APIs</book><book id="2">YAML</book></catalog>
After
{
"catalog": {
"book": [
{"@id":"1","#text":"JSON & APIs"},
{"@id":"2","#text":"YAML"}
]
}
}- Attributes are stored as @name fields. Text on elements with attributes or children is stored as #text. Repeated sibling tags form an array.
- Text and attribute values stay strings. Qualified names and namespace declarations are retained as names, not resolved into application-specific identifiers.
- This is not a lossless XML round trip: comments, processing instructions, mixed-text ordering and insignificant whitespace are not represented. A root named root is unwrapped for compatibility with the JSON-to-XML tool.
Frequently Asked Questions
How does XML get converted to JSON?
Each XML element becomes a JSON key. Nested elements become nested objects, and an element that repeats under the same parent (like multiple <item> tags) becomes a JSON array automatically.
What happens to XML attributes?
Attributes become @name fields and element text becomes #text when needed. Repeated sibling tags become arrays. Qualified names are retained; mixed-text ordering and comments are not preserved.
Does it handle deeply nested XML?
The converter walks nested elements recursively. Very deep or large documents are limited by browser memory and call-stack capacity.
What if my XML is invalid?
The converter parses your XML with a standard XML parser and reports a parse error immediately if the document isn't well-formed — check for unclosed tags or mismatched elements first.
Is my data uploaded anywhere?
No. Parsing and conversion happen entirely in your browser. Nothing is sent to a server.