Convert XML documents to JSON format for use in APIs, databases, and modern JavaScript applications. Handles nested elements, XML attributes, CDATA sections, and RSS/Atom feeds. The output JSON reflects the XML structure with attributes prefixed by @_ for clarity. Useful for consuming legacy SOAP APIs, parsing RSS feeds, or processing XML data exports.
Paste your XML
Paste any valid XML — data files, RSS feeds, SOAP responses, Android resource files, configuration files, or SVG data.
Click Convert
fast-xml-parser parses the XML into a JavaScript object. Element text content, attributes (prefixed @_), and nested child elements all map to JSON properties.
Review the structure
XML's hierarchical structure maps naturally to JSON objects. Elements with multiple children of the same tag become JSON arrays. Attributes appear as @_attributeName properties.
Copy or download
Copy the formatted JSON or download it as a .json file for use in your application.
XML attributes (e.g., <person age="30">) are represented in the JSON with an @_ prefix: { "@_age": "30" }. This distinguishes attributes from child elements and is the convention used by most XML-to-JSON parsers. The root element name becomes the top-level key in the JSON.
When an XML element has multiple children with the same tag name (<item>A</item><item>B</item>), they're converted to a JSON array: { "item": ["A", "B"] }. When only one such element exists, it's a single value (not an array). This is a common source of bugs when consuming XML APIs — always handle both cases in your code.
Yes. RSS feeds are valid XML and convert cleanly to JSON. The feed structure (channel, item, title, link, description, pubDate) maps directly to JSON. This is useful for consuming RSS feeds in applications that expect JSON, or for archiving feed content in databases.
CDATA sections (<![ CDATA[...]]>) contain raw text that shouldn't be parsed as XML markup. The fast-xml-parser library extracts CDATA content as plain text in the JSON output, just like normal text nodes.
XML has features with no direct JSON equivalent: processing instructions (<?...?>), DOCTYPE declarations, comments, and mixed content (elements containing both text and child elements). These are typically ignored or dropped during conversion. For simple data-carrying XML (no mixed content), conversion is lossless. For document-centric XML (like XHTML), some structure is lost.
Something not working? Report a bug