XML to JSON Converter
Transform any XML document into clean, structured JSON with full fidelity. Fine-tune the output by choosing whether to map XML attributes as prefixed keys, include text nodes, or produce compact versus pretty-printed JSON. Conversion happens entirely in your browser — paste your XML and get instant results with no server required.
XML
Parsing Options
JSON
What is XML to JSON Converter?
Legacy enterprise systems, SOAP APIs, RSS feeds, and Android configuration files all produce XML — but virtually every modern tool that consumes data expects JSON. Converting between the two manually means either writing a parser or wrestling with XSLT. This tool handles the conversion in the browser using the native DOM parser, which correctly processes malformed-but-valid HTML-style XML that strict parsers reject. The tricky part of XML-to-JSON conversion is always attributes: this converter gives you four options — merged as sibling keys, prefixed with "@", grouped in an "_attributes" object, or ignored entirely. Repeated sibling elements with the same tag name are automatically collected into JSON arrays rather than silently overwriting each other. CDATA sections are extracted as plain string values. Namespace prefixes can be preserved or stripped.
How to Use
- 1
Paste Your XML
Paste your XML document into the input editor or drag-and-drop a .xml file. The editor uses the browser's native DOM parser and highlights malformed tags or missing namespace declarations.
- 2
Configure Attribute Mapping
Choose how XML attributes are handled: merged as sibling keys, prefixed with "@", placed in an "_attributes" object, or ignored. Set how text nodes and CDATA sections are represented in the output.
- 3
Convert to JSON
Click "Convert to JSON". The DOM tree is traversed and serialised as a nested JSON object, with array detection for repeated sibling elements to produce clean, idiomatic JSON structure.
- 4
Copy or Download the JSON
Copy the resulting JSON for use in your application, REST API, or data pipeline — or download it as a .json file for processing with jq, Python, or Node.js tooling.
Common Use Cases
SOAP to REST Migration
Extract data from SOAP XML responses and convert it to JSON to integrate legacy SOAP services with modern REST-based frontends, mobile apps, or microservices without rewriting the backend.
RSS / Atom Feed Parsing
Convert RSS or Atom XML feeds into JSON arrays to consume blog posts, news items, or podcast episodes in JavaScript applications, React components, or data pipelines.
Configuration File Conversion
Many enterprise tools export configuration as XML (Maven pom.xml, Spring beans, Ant build files). Convert them to JSON to process programmatically with modern tooling or to migrate to JSON-native config formats.
Legacy System Data Extraction
Extract data from XML-based exports from ERP, CRM, or EDI systems and convert them to JSON for ingestion into modern databases, analytics platforms, or cloud-native APIs.
Conversion Examples
XML Element → JSON Object
XML child elements become JSON keys; text content becomes string values.
Input JSON
<?xml version="1.0"?> <user> <id>1</id> <name>Alice</name> <email>alice@example.com</email> </user>
Output CSV
{
"user": {
"id": "1",
"name": "Alice",
"email": "alice@example.com"
}
}XML with Attributes → JSON with @attributes
XML element attributes are mapped to a special key in the JSON output.
Input JSON
<products>
<item id="101" category="electronics">
<name>Laptop</name>
<price>999</price>
</item>
</products>Output CSV
{
"products": {
"item": {
"@attributes": {"id": "101", "category": "electronics"},
"name": "Laptop",
"price": "999"
}
}
}