XML to JSON Converter

Paste XML, get formatted JSON

Input (XML)

Output (JSON)

XML to JSON Converter guide

XML still shows up in RSS feeds, SOAP APIs, sitemaps, and older config files. This converter turns XML into JSON so you can inspect it or use it from JavaScript.

How it converts

  • Elements. Each element name becomes a key, and nested elements become nested objects.
  • Repeated elements. Two or more elements with the same name become an array.
  • Attributes. Ignored. Only element content is converted, so move attribute values into child elements if you need them.
  • Numbers. Numeric text becomes a JSON number, so 042 becomes 42.

Example

<note>
  <to>Ann</to>
  <tag>a</tag>
  <tag>b</tag>
</note>

// converts to

{
  "note": { "to": "Ann", "tag": ["a", "b"] }
}

Frequently asked questions

Why are my XML attributes missing?
The converter reads element content only. Attributes like id="7" are not included in the JSON.
Why did a value lose its leading zero?
Numeric text is converted to a JSON number, and numbers do not keep leading zeros. Values like zip codes or IDs are affected.
Why is one element an array and another not?
An element becomes an array only when it appears more than once under the same parent. A single element stays a plain value.