XML to JSON Converter

Turn an XML feed, SOAP response or config into JSON you can use in JavaScript. Attributes become @name keys and repeated elements become arrays.

Input · drop a file

Output

Mapping rules

XMLJSON
<name>Ada</name>"name": "Ada"
Attribute id="7""@id": "7"
Repeated <item> siblingsAn array "item": [ … ]
Text next to child elements or attributes"#text": "…"

XML has no types, so every value stays a string. A single child is an object, but two of the same name become an array. If your code needs a consistent array, check for both.

The reverse button turns JSON into XML using the same conventions, so a round trip gives you back the same structure.

Questions

What happens to namespaces?

Prefixed names are kept as written, e.g. "soap:Body". Namespace declarations appear as @xmlns attributes.

Why are numbers in quotes?

XML text is untyped. Convert the values you need in your code, or post-process in the JSON formatter.

Related tools