XML to JSON Converter

Convert XML to JSON instantly. Free online XML to JSON converter — paste your XML and get structured JSON output. No signup, runs in browser.

FreeNo signupBidirectionalRuns in browser
Indent:
Input XML
JSON output
Advertisement

XML to JSON — Modernizing Legacy Data for Modern APIs

The web has largely moved from XML to JSON, but legacy data sources haven't. RSS feeds, SOAP APIs, government data portals, healthcare systems (HL7), and financial data (FIX, SWIFT) still use XML extensively. Converting XML to JSON is often the first step in integrating these legacy sources with modern JavaScript applications, REST APIs, and NoSQL databases that natively speak JSON.

How XML attributes convert

XML has a feature JSON doesn't — element attributes. <user id="123" active="true">Alice</user> has both attributes and text content. When converting to JSON, attributes typically become properties with a prefix (like @_id). The element's text content becomes a special key. This tool uses fast-xml-parser which gives you readable, consistent output for both attributes and content.

Handling repeated XML elements

In XML, having multiple elements with the same tag name (<item>...<item>...<item>) is the standard way to represent arrays. The converter detects this pattern and produces a proper JSON array. A single <item> becomes an object; multiple <item> elements become an array of objects. This is the most common source of confusion in XML-to-JSON conversion.

Processing RSS feeds

RSS and Atom feeds are XML. Converting them to JSON makes them trivial to process in JavaScript. After conversion, feed.rss.channel.item gives you an array of articles with titles, links, descriptions, and publication dates — ready to render in a React component or store in a database without any XML parsing libraries.

Frequently asked questions

How do XML attributes convert to JSON?
XML attributes become JSON keys with an @ prefix by default (e.g. becomes {"@_id":"1"}). The converter handles both attributes and element text values.
What happens to XML namespaces?
XML namespaces are preserved as part of the key name. For complex namespace-heavy XML, you may need to post-process the JSON to clean up the namespace prefixes.
Can I convert SOAP XML to JSON?
Yes. Paste your SOAP envelope XML and click Convert. The full structure including the SOAP body and headers will be converted to nested JSON objects.
Why does my XML have duplicate tags?
When XML has multiple elements with the same tag name, they convert to a JSON array. This is the correct behavior — e.g. multiple elements become an items array.
Is the conversion lossless?
Mostly. XML supports features JSON does not (comments, processing instructions, CDATA). These are stripped during conversion. Data content is fully preserved.
Is my data safe?
Yes. All conversion runs in your browser using fast-xml-parser. Nothing is uploaded.