XML to JSON Converter - Convert XML to JSON Online
Convert XML to JSON
Paste XML on the left and the JSON equivalent appears on the right. The
root element becomes the top-level key, child elements become nested
objects, repeated siblings become arrays and attributes go under
@attributes. The XML is parsed with your browser's
built-in DOMParser, so nothing is uploaded, and a
malformed document shows the parser's error instead of partial output.
Example
<order id="1042" currency="NZD">
<customer>Ann</customer>
<item sku="A1">Mug</item>
<item sku="B7">Tea</item>
<note><![CDATA[Leave at door & ring]]></note>
</order> converts to:
{
"order": {
"@attributes": { "id": "1042", "currency": "NZD" },
"customer": "Ann",
"item": [
{ "@attributes": { "sku": "A1" }, "#text": "Mug" },
{ "@attributes": { "sku": "B7" }, "#text": "Tea" }
],
"note": "Leave at door & ring"
}
}
Note that id is the string "1042", not a
number, and that with a single <item> the
item key would hold an object instead of an array. (The
real output puts each key on its own line.)
Where XML Still Turns Up
SOAP responses, RSS and Atom feeds, sitemaps, Maven
pom.xml files, Android resources and many bank and
government data exports are XML. Converting a sample to JSON is a
quick way to see its structure before writing parsing code, or to
query it with the JSON path finder. To
go the other way, use the JSON to XML
converter.
Related Tools
JSON to YAML Converter
Convert JSON data to clean, readable YAML format instantly.
JSON to XML Converter
Transform JSON objects and arrays into well-formed XML documents.
JSON to CSV Converter
Flatten JSON arrays into downloadable CSV spreadsheets in one click.
YAML to JSON Converter
Convert YAML configuration files to JSON format instantly.