DocumentsImagesMediaPDF Tools

Convert XML to JSON Online

Convert XML to JSON in your browser. Ideal for SOAP-to-REST migration, RSS/Atom feed parsing, or legacy XML processing.

// Invalid XML: DOMParser is not defined
Processed in your browser

XML to JSON: modernize your data stack

SOAP to REST migration

Convert SOAP web service responses (XML) to JSON to integrate with modern REST APIs and JavaScript clients.

RSS and Atom feeds

Parse RSS 2.0 and Atom 1.0 feeds to JSON for processing with JavaScript, storing in MongoDB, or displaying in web apps.

100% private

Your XML is processed in your browser with the native DOMParser. Never leaves your device.

Legacy XML

Process Android resources (strings.xml, layouts), sitemaps, SOAP manifests, or any legacy XML format.

Three steps, no hassle

1

Paste your XML

Paste any valid XML: SOAP response, RSS/Atom feed, sitemap.xml, Android manifest, or any XML 1.0 document.

2

Intelligent conversion

XML attributes are converted with @ prefix, text content with #text, and repeated elements are automatically grouped into arrays.

3

Download or copy JSON

Get structured JSON ready to use in your REST API, NoSQL database, or JavaScript/Python code.

Got questions?

XML allows both child elements and attributes to store data, with no direct JSON equivalent. The most widely adopted convention (used by xml2js in Node.js, xmltodict in Python, and JAXB in Java) is to prefix attributes with @: the element <user id="42" role="admin"> becomes {"user": {"@id": "42", "@role": "admin"}}. Text content of mixed elements (those with both attributes and text) is placed in the #text key: <title lang="en">Hello</title> becomes {"title": {"@lang": "en", "#text": "Hello"}}. This convention is consistent with the BadgerFish specification and the most popular ecosystem tools.

In XML, it is perfectly valid to have multiple sibling elements with the same name: <items><item>A</item><item>B</item></items>. JSON cannot represent multiple identical keys in the same object (that would be invalid JSON per RFC 7159). The standard solution is to group them into an array: {"items": {"item": ["A", "B"]}}. A good converter automatically detects repeated elements and converts them to arrays, even when there are only two. This can cause inconsistencies if sometimes there is one element and sometimes several: the JSON would have a string in one case and an array in another. The solution is to always normalize to array for fields that can repeat.

XML namespaces (defined by the W3C in 'Namespaces in XML 1.0', published January 1999 and revised August 2006) are an XML feature with no JSON equivalent. The most common representation is to include the namespace prefix as part of the key name: the element <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> becomes {"soap:Body": {...}}. Namespace declarations (xmlns:prefix="uri") are treated as attributes and appear as @xmlns:prefix. For use cases like SOAP-to-REST migration where namespaces are pervasive, post-processing is often needed to strip namespace prefixes from the resulting JSON.

CDATA (Character Data) is a special XML section that allows including text containing normally reserved characters (< > & ' ") without using XML entities (&lt; &gt; &amp;). The syntax is <![CDATA[content here]]>. CDATA is frequently used to include HTML, JavaScript, SQL, or any text with special characters inside an XML element. In JSON conversion, CDATA content is treated as plain text: CDATA sections are replaced by their content without the markup, and the result is placed as a normal string in the JSON field value. If XML has <description><![CDATA[<b>Bold text</b>]]></description>, the resulting JSON is {"description": "<b>Bold text</b>"}.

Conversion happens in your browser using the browser's native DOMParser to parse XML and a custom JSON serializer. DOMParser can handle XML files of several tens of MB in modern browsers (Chrome, Firefox, Edge). For large files (over 10 MB), the process may take several seconds. For very large XML files (over 100 MB, like sitemaps with hundreds of thousands of URLs or XML database dumps), we recommend streaming tools like xml2json in Node.js with streams, xmltodict in Python with xml.etree's iterparse mode, or the Saxon processor for enterprise-grade XML.

Convert XML to JSON: SOAP to REST migration, RSS feeds, and legacy XML processing

XML (Extensible Markup Language) was defined by the W3C in the XML 1.0 recommendation (published February 10, 1998, currently in its fifth edition from November 2008). Throughout the 2000s, XML was the universal data interchange format: SOAP (Simple Object Access Protocol, W3C specification 2003) used XML as its message format, RSS 2.0 (released by Dave Winer in 2002) and Atom 1.0 (RFC 4287, December 2005) distributed news feeds in XML, Android (launched by Google in 2008) used XML for layouts, strings, and application manifests, and SVG (Scalable Vector Graphics, W3C 1.1 from 2003) is XML. The transition to JSON as the primary interchange format began with the popularization of AJAX and Douglas Crockford's JSON specification (RFC 4627, July 2006, superseded by RFC 7159 in 2014). Today, most new APIs use JSON/REST, but millions of legacy systems, B2B services, and industry-standard formats (UBL, HL7 FHIR in XML, SOAP, KML, GPX) still use XML.

Converting XML to JSON is non-trivial because the two data models have fundamental conceptual differences. XML is a node tree model (elements, attributes, text, comments, processing instructions, CDATA) where elements can have both attributes and child/text content simultaneously. JSON is a value tree model (objects, arrays, strings, numbers, booleans, null) with no concept of attributes separate from content. The main conventions for conversion are: XML attributes as keys with @ prefix (BadgerFish/xml2js convention); mixed element text in the #text key; repeated elements grouped into arrays; namespaces preserved as key prefixes; CDATA treated as plain text. The BadgerFish convention, documented at badgerfish.de and adopted by the most popular libraries, is the de facto standard for this conversion.

For high-scale production use cases, the most widely used tools are: xml2js (Node.js, over 25 million monthly downloads on npm), xmltodict (Python, based on the standard library's xml.etree), JAXB (Java, part of Jakarta EE), and encoding/xml (Go standard library). For migrating legacy SOAP services to REST, tools like Apache Camel, MuleSoft Anypoint, and AWS API Gateway with payload transformations offer native XML-to-JSON integration at the middleware level. For sitemap.xml (the Sitemaps protocol defined at sitemaps.org, adopted by Google in 2005), converting to JSON allows processing URL lists with JavaScript without an XML parser. Convertir.ai uses the browser's native DOMParser (W3C standard API, available in all modern browsers since 2004) to parse XML and a custom serializer to generate JSON, guaranteeing total privacy by sending no data to the server.