XML to JSON & JSON to XML

Convert between XML and JSON in either direction — with a clear convention for attributes and repeated elements.

Local processing: your data is processed in your browser and never sent to Numelto or any external service.

The conversion isn't a perfect 1:1

XML and JSON aren't 100% interchangeable: XML has attributes, mixed content (text and elements interleaved), comments and namespaces, and JSON has no native equivalent for any of that. This tool uses an explicit convention instead of promising an exact translation:

The convention used

An XML attribute becomes a JSON key prefixed with "@" (e.g. @id). The text of an element that also has attributes or children is stored under the "#text" key. Several sibling elements with the same name become an array. Namespaces (xmlns, prefixes like ns:tag) are kept as-is in the key name, never resolved.

Privacy

The conversion happens in your browser, using the browser's own XML parser. It's never sent to Numelto.

Example of the convention

For the resulting JSON, use the JSON formatter to validate or beautify it.

XMLJSON
<book id="1">Title</book>{ "book": { "@id": "1", "#text": "Title" } }
Several sibling <item> elementsAn array of items

Frequently asked questions

Related tools

We use analytics cookies to understand which calculators are useful. They are never used for advertising. More information in our privacy policy.