XML to JSON

Paste XML from a feed, an export or a SOAP response and get clean JSON. Repeated elements become arrays and attributes can be kept.

INPUT

0 characters0 lines

OUTPUT

0 characters0 lines

Runs entirely in your browser. Nothing you enter is sent to a server.

How to convert XML to JSON

  1. Paste the XML

    Paste the document or open an .xml file. It is checked for well-formedness first.

  2. Choose about attributes

    Keep attributes as @name keys, or leave them out for a simpler result.

  3. Copy the JSON

    Copy the result or download it as a .json file.

How XML maps to JSON

Each element becomes a key. An element that appears more than once under the same parent becomes an array, attributes become keys starting with @, and text next to child elements is stored under #text.

What is left out

Comments, processing instructions and the XML declaration have no place in JSON and are dropped. CDATA sections are kept as plain text.

Frequently asked questions

Why is a single item not an array?

XML doesn't say whether an element can repeat, so one occurrence becomes an object and two or more become an array. Check this when your code expects a list.

Are namespaces supported?

Yes. Prefixed names such as soap:Body are kept as they are in the keys.

Is my XML uploaded?

No. Parsing and conversion happen in your browser.