XML to JSON Converter
Convert XML documents to valid JSON instantly with AI — free, no login required.
Legacy APIs, RSS feeds, and SOAP services still return XML. Convert XML to JSON so you can work with it in JavaScript, TypeScript, or any modern framework. Handles nested elements, attributes, and arrays automatically.
Paste your code, then click Convert
JSON
How to use this tool?
This online converter harnesses AI to convert XML to valid JSON instantly. Follow these steps:
- Type or paste your XML into the input box provided.
- Click the "Convert" button to transform the XML structure to JSON.
- View the JSON output in the output box, ready to copy and use.
Example: Simple Function
XML
<user id="1">
<name>Alice</name>
<email>alice@example.com</email>
</user>JSON
{
"user": {
"@attributes": { "id": "1" },
"name": "Alice",
"email": "alice@example.com"
}
}More tools
From the blog
View all →
Jun 8, 2026
JavaScript Object to JSON: Serialization Patterns and Common Pitfalls

Jun 8, 2026
TypeScript to JavaScript: When and How to Strip Types

Jun 4, 2026
JavaScript Object to JSON: Serialization Patterns and Common Pitfalls

Jun 4, 2026
TypeScript to JavaScript: When and How to Strip Types

Jun 1, 2026
JSON to TypeScript: Auto-Generate Interfaces from API Responses
How to Convert XML to JSON
XML is verbose and hierarchical — parsing it to use in JavaScript APIs or modern applications requires converting elements, attributes, and text nodes into JSON. Manual conversion means handling XML namespaces, CDATA sections, attributes vs element text, and array vs single-element ambiguity.
The XML to JSON converter handles the full parsing pipeline. Paste any XML document and get a clean JSON representation — ready for use in JavaScript, REST APIs, or data processing pipelines.
Why Use a XML to JSON Converter?
- →Consume legacy XML APIs in modern JavaScript/TypeScript applications
- →Convert XML config files (pom.xml, web.config) to JSON for processing
- →Transform RSS/Atom feeds to JSON for display in web applications
- →Migrate SOAP web service responses to REST-friendly JSON
What the XML to JSON Converter Handles
Frequently Asked Questions
How are XML attributes represented in JSON?
XML attributes are placed inside an '@attributes' key within the corresponding JSON object. For example, <user id="1"> becomes { "user": { "@attributes": { "id": "1" } } }.
What happens to repeated XML elements?
Repeated sibling elements with the same tag name are grouped into a JSON array. For example, multiple <item> elements become an array under the 'item' key.
Are XML namespaces and declarations preserved?
XML declarations (<?xml ...?>) and comments are stripped. Namespace prefixes are kept as part of the key name in the JSON output.
Can I convert large XML responses from APIs?
Yes. Paste any XML — REST API responses, SOAP payloads, RSS feeds, or config files — and get the equivalent JSON structure.
Is the tool free?
Yes, completely free with no account required.
How do I convert XML to JSON in JavaScript?
Use DOMParser to parse the XML string, then traverse the DOM to build a JSON object. Alternatively, use libraries like xml2js or fast-xml-parser. The JS2TS XML to JSON converter does this instantly — paste XML and copy JSON.
How are XML attributes converted to JSON?
XML attributes (like <element id="1">) are typically converted to JSON properties, often with an @ prefix or as a separate _attributes key depending on the conversion style. The converter uses a clean, flat representation.
How are repeated XML elements handled in JSON?
Repeated sibling elements with the same tag name are converted to a JSON array. Single elements become plain objects. The converter handles this automatically.
Can I convert RSS feeds from XML to JSON?
Yes. RSS and Atom feeds are XML documents. Paste the feed XML and get a JSON representation of the channel, items, titles, links, and descriptions.
What is the difference between XML and JSON?
XML uses opening and closing tags with attributes and supports mixed content. JSON uses key-value pairs with a simpler syntax. JSON is native to JavaScript, lighter weight, and easier to parse. Most modern APIs use JSON; XML is common in enterprise and legacy systems.

