XML to JSON — Convert XML Documents to JSON Online
🔒 Runs in your browser — nothing is sent to a serverXML to JSON converts any XML document — a SOAP envelope, an SVG file, an Office Open XML part, an RSS feed, an Android layout — into a clean JSON tree in one click. Paste the XML, and this XML to JSON converter parses it with the AST-based `fast-xml-parser` library, maps attributes to keys prefixed with `@`, mixed text content to `#text`, and emits pretty-printed JSON ready for an API call, a JavaScript transform or a config import. Number and boolean parsing, namespace preservation and array coercion are all toggleable. Everything runs 100% inside your browser; your XML never leaves your device, nothing is uploaded, logged or sent to any server.
Convention: attributes are prefixed with @, mixed text content uses #text.
When to use an XML to JSON converter online
You reach for an XML to JSON converter any time XML-shaped data needs to flow into a JSON-native pipeline: parsing a SOAP response from a legacy enterprise service, ingesting an RSS or Atom feed into a JSON-store, transforming an SVG into a programmatic representation, importing an Android layout into a documentation tool, or feeding an Office Open XML part to a JavaScript validator. Browser-local conversion matters when the XML carries SAML assertions, signed envelopes, customer-facing payloads or any sensitive data you would rather not paste into a remote SaaS converter.
How XML to JSON conversion works under the hood
XML to JSON conversion is a parse-then-emit pipeline. The fast-xml-parser tokenizer reads the source character by character, recognising the XML declaration, DOCTYPE, opening and closing tags, attributes, text nodes, CDATA sections, comments and processing instructions. The parser builds an in-memory tree that mirrors the document structure; attributes attach to each tag, mixed text content uses the `#text` key, and tags with two or more same-named siblings collapse into a JSON array. Number and boolean parsing runs each value through a typed-coercion check, namespaces are preserved or stripped per option, and the resulting tree is serialised with `JSON.stringify(value, null, 2)` — pretty-printed and ready to copy into a fixture file or paste into Postman. The whole pipeline runs inside the browser engine in milliseconds, even on multi-megabyte XML payloads.
Examples
<?xml version="1.0" encoding="UTF-8"?>
<book id="1" available="true">
<title>Atlas</title>
<author>A. Reyes</author>
<year>2024</year>
</book>{
"book": {
"@id": 1,
"@available": true,
"title": "Atlas",
"author": "A. Reyes",
"year": 2024
}
}<catalog>
<book id="1"><title>Atlas</title></book>
<book id="2"><title>Vesper</title></book>
<book id="3"><title>Beacon</title></book>
</catalog>{
"catalog": {
"book": [
{
"@id": 1,
"title": "Atlas"
},
{
"@id": 2,
"title": "Vesper"
},
{
"@id": 3,
"title": "Beacon"
}
]
}
}<tool>
<name>xml to json</name>
<role>parse xml to json with attribute mapping</role>
<client>free-converter.online</client>
</tool>{
"tool": {
"name": "xml to json",
"role": "parse xml to json with attribute mapping",
"client": "free-converter.online"
}
}<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="10"/>
</svg>{
"svg": {
"@xmlns": "http://www.w3.org/2000/svg",
"@viewBox": "0 0 24 24",
"circle": {
"@cx": 12,
"@cy": 12,
"@r": 10
}
}
}