This free XML to JSON Converter helps you change XML content into JSON in just a few steps. Provide your XML by typing or pasting it into the input field, or choose an XML file from your device. Extra settings let you specify an attribute prefix, customize the text property label, and decide how the JSON should be arranged.
Once your XML has been converted, you can copy the converted JSON or download it for later use. If the conversion is interrupted by XML errors, run the content through our XML Validator or tidy it with our XML Formatter before trying again.
XML to JSON Converter
Converted JSON
Key Features
- Quickly transforms XML data into JSON with clean and accurate output.
- Choose from multiple formatting styles, including 2-space, 3-space, 4-space, tab-indented, compact, or JavaScript-escaped JSON.
- Customize the prefix applied to XML attributes when they are converted into JSON properties.
- Define your preferred property name for XML text (
#text) values in the generated JSON. - Enjoy syntax highlighting to make JSON objects easier to read and understand.
- Convert data by either pasting XML directly into the editor or uploading an XML file from your device.
- Copy the converted JSON instantly or download it for later use.
XML To JSON Conversion Example
XML Document
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book>
<id>201</id>
<title>Clean Code</title>
<author>Robert C. Martin</author>
<price>39.99</price>
</book>
<book>
<id>202</id>
<title>Atomic Habits</title>
<author>James Clear</author>
<price>24.50</price>
</book>
<book>
<id>203</id>
<title>The Pragmatic Programmer</title>
<author>Andrew Hunt</author>
<price>42.00</price>
</book>
</library>
Converted JSON
{
"library": {
"book": [
{
"id": "201",
"title": "Clean Code",
"author": "Robert C. Martin",
"price": "39.99"
},
{
"id": "202",
"title": "Atomic Habits",
"author": "James Clear",
"price": "24.50"
},
{
"id": "203",
"title": "The Pragmatic Programmer",
"author": "Andrew Hunt",
"price": "42.00"
}
]
}
}