JSON to XML
XML
JSON
Empty Runs in your browser

XML to JSON Converter Online - Free & Private

Paste XML or drop a file and get JSON you can work with in JavaScript, Python or any API. Attributes are kept with an @ prefix, repeated elements become arrays, and numbers and booleans can be converted to real values.

How to convert XML to JSON

  1. Paste XML into the left editor, or open or drop an .xml file, an RSS or Atom feed, a sitemap or a SOAP response.
  2. JSON appears on the right. If the XML is not well formed, for example a tag is never closed, the error and its line number are shown.
  3. Explore the result in tree view, copy it, or download it as a .json file.

How XML maps to JSON

Options

Example

<catalog>
  <book id="bk101"><price>44.95</price></book>
  <book id="bk102"><price>5.95</price></book>
</catalog>

becomes {"catalog":{"book":[{"@id":"bk101","price":44.95},{"@id":"bk102","price":5.95}]}}.

To go back, use the JSON to XML converter.

Private by design

The XML is parsed by your browser's own XML parser. Nothing is uploaded, and external entities are never fetched.

Frequently asked questions

How do I convert XML to JSON?

Paste XML into the left editor or open an .xml file. JSON appears on the right. Choose how to handle attributes and arrays, then copy or download the .json file.

How are XML attributes shown in JSON?

Attributes become keys with an @ prefix by default, so id="bk101" becomes "@id": "bk101". You can change the prefix or leave attributes out.

Why is an element sometimes an array and sometimes not?

An element that appears more than once becomes an array, and one that appears once stays a single value. Turn on Always arrays to get arrays every time, which is easier to loop over in code.

Can I convert RSS feeds, sitemaps or SOAP responses?

Yes. Any well-formed XML works, including RSS and Atom feeds, sitemaps and SOAP envelopes. Namespace prefixes are kept in the key names.

Editor settings

Type

{
  "id": 1024, "name": "Ada", "active": true,
  "tags": ["0O", "1lI", "=> != >="], "manager": null
}

Colour theme

Code editor

Defaults

Send feedback

How is online-json working for you?