Document

XML to JSON Converter Online Free

Upload an XML file or paste XML and download it as a formatted JSON object. Attributes are prefixed with @, repeated elements become arrays.

XML to JSON
Upload a file or paste XML below
Upload File
Paste XML
Click to upload or drag & drop an .xml file
XML attributes become @attributeName keys. Repeated sibling elements are collapsed into a JSON array. Text-only elements become string values.
0%
Download JSON

How to convert XML to JSON

Turn an XML document into JSON — for working with an older SOAP or enterprise feed in code that expects JSON, or simply to read a dense XML payload in a shape that is easier to scan.

  1. Paste your XML, or upload the file.
  2. Check it is well formed; an error reports where it breaks.
  3. Convert to JSON.
  4. Copy or download the result.

Accepts any well-formed XML document. Nothing is retained after the conversion, and uploads are deleted automatically within 24 hours.

Frequently asked questions

What happens to XML attributes?

Attributes are kept as properties, distinguished from child elements by a prefix, since JSON has no separate notion of an attribute. This is the convention most XML-to-JSON libraries follow.

Why did a repeated element become an array in one place but not another?

XML gives no way to declare that an element repeats, so a single occurrence looks like an object and two look like an array. If your consumer needs an array always, normalise it after converting.

Are namespaces preserved?

Namespace prefixes are retained in the property names, so you can tell elements from different schemas apart.

What about comments and processing instructions?

They are dropped. JSON has nowhere to put them.