XML to JSON
Convert XML documents into clean, predictable JSON.
Runs fully in your browser. Nothing you paste here is sent anywhere.PrivateXML
JSON
About this tool
Paste an XML document — a SOAP response, an RSS feed, a Maven POM, a config file — and read it as JSON while you type. The mapping is the one most libraries use: each element becomes a key, repeated siblings become an array, attributes become keys with an @ prefix, and text that sits next to attributes or child elements goes under #text. An element holding only text becomes that text, and an empty one becomes an empty string.
Values that are clearly numbers or booleans are converted, but only when the JSON would print back the same characters, so a ZIP code such as 02108, a price such as 1.10 and an ID too long for a double stay strings. Entities are decoded, CDATA content is kept exactly as written, and indentation between elements is dropped unless the document asks for xml:space="preserve". Comments, the XML declaration and the doctype carry no data and are left out.
When the XML is broken, the error is reported by line and column with the offending tag underlined, and the last good result stays visible underneath. Input that arrived escaped inside a JSON string or URL-encoded is unwrapped first, and the relaxations real documents arrive with — unquoted attributes, attributes without a value, more than one root — are accepted and flagged below the input.
Nothing you paste is transmitted. The page is static HTML and the parser runs in your tab, so API responses with customer data or internal hostnames are safe to convert here.
Frequently asked questions
Is my XML uploaded anywhere?
No. The conversion is plain JavaScript running in your browser, and there is no server endpoint to send it to. You can disconnect from the network after the page loads and it keeps working.
How are attributes and repeated elements represented?
Attributes become keys prefixed with @ — or with _ or -, if the code consuming the JSON prefers — so id="7" is "@id": 7. An element that appears more than once under the same parent becomes an array. Because an element that appears once is a plain value, the shape can change between two documents; turn on "Always use arrays" to wrap every child element in an array and get the same shape every time.
Why are some numbers left as strings?
A number is only converted when JSON would write it back identically. 007 would lose its zeros, 1.10 would become 1.1 and a 20-digit ID would lose precision, so those stay strings. Turn off "Detect numbers & booleans" to keep every value a string, exactly as it was in the XML.
What does "Strip namespaces" do?
It removes prefixes such as soap: or xsi: from element and attribute names and drops the xmlns declarations, so soap:Envelope becomes Envelope. It makes SOAP and Atom payloads much easier to read and query, but two elements from different namespaces with the same local name will then share a key.
What is not supported?
Converting JSON back to XML, and entities declared in a DTD such as , which are kept as written rather than guessed at. Mixed content — text with inline tags, as in XHTML — is flattened: the text pieces are joined under #text and their position relative to the tags is lost. Documents of several megabytes convert, with a short pause while typing.
Is it really free?
Yes, with no account and no usage limit. The site is funded by ads placed around the tool, never inside your working area.