Convert XML to JSON in your browser
Paste a well-formed XML document and get clean, indented JSON. This is the tool you reach for when an API or legacy system speaks XML but your JavaScript, config tooling or REST client wants JSON — feeds, SOAP responses, sitemaps and export files all convert in one step.
How it works
Parsing uses the browser’s native DOMParser, the same engine that reads real web documents, so behaviour matches how a browser interprets your markup. The tool then walks the resulting DOM tree recursively with a deterministic convention:
- Attributes on an element are collected into an
@attributesobject. - A child tag name that appears more than once becomes a JSON array.
- A leaf element with only text and no attributes becomes a plain string.
- An element with both attributes and text keeps the text under a
#textkey.
If DOMParser injects a parsererror node — its signal for malformed input — the
tool reports a clear error rather than emitting a half-broken object.
Example
Input:
<order id="1001" paid="true">
<customer>Gera Tools</customer>
<items>
<item>Pliers</item>
<item>Wrench</item>
</items>
</order>
Output:
{
"@attributes": { "id": "1001", "paid": "true" },
"customer": "Gera Tools",
"items": { "item": ["Pliers", "Wrench"] }
}
Note id/paid landed under @attributes, the single customer is a string, and
the two <item> tags collapsed into an array.
Everything runs locally in your browser using the built-in DOMParser — your data is never uploaded or stored.