JSON to XML
Convert JSON to well-formed XML with custom root and item names, attributes, and indentation.
Convert XML to clean, structured JSON instantly. Free, private, and 100% in your browser.
Many legacy systems, SOAP services, and feeds speak XML, while modern applications and JavaScript code work best with JSON. This converter turns XML into JSON using clear, widely used conventions, so the result is easy to work with in any language.
Elements become keys, repeated elements become arrays, and attributes become @-prefixed keys.
Optionally turn "42", "true", and "false" into real numbers and booleans, only when the conversion is lossless.
Uses the same conventions as our JSON to XML converter, so you can convert back and forth.
Malformed XML is reported with the exact line and column before anything is converted.
CDATA sections and entities such as & are decoded into plain text.
The conversion runs entirely in your browser. Your data is never uploaded.
<book id="bk101">
<title>Clean Code</title>
<author>Robert C. Martin</author>
<tag>programming</tag>
<tag>craft</tag>
<price currency="USD">32.5</price>
</book>{
"book": {
"@id": "bk101",
"title": "Clean Code",
"author": "Robert C. Martin",
"tag": [
"programming",
"craft"
],
"price": {
"@currency": "USD",
"#text": 32.5
}
}
}
The id attribute becomes @id, the two <tag> elements become an array, and because <price> has an attribute, its value is stored under #text as the number 32.5.
Attributes become keys prefixed with @. For example, <book id="bk101"> becomes {"book": {"@id": "bk101"}}. If an element has both attributes and text, the text is stored under a #text key.
Elements with the same name inside one parent become a JSON array. A single element becomes a plain value. For example, two <tag> elements become "tag": ["a", "b"].
XML has no data types, so everything is text. With this option on, values like 42 and true become JSON numbers and booleans. Values that would change, such as 007, 1.50, or very large IDs, stay strings so no information is lost.
Comments, processing instructions, and the XML declaration are not data, so they are left out of the JSON output.
No. The converter runs entirely in your browser using JavaScript. Your XML never leaves your device.
Convert JSON to well-formed XML with custom root and item names, attributes, and indentation.
Convert XML documents and configs into clean, readable YAML.
Turn repeated XML records into a CSV table for Excel or Google Sheets, with automatic row detection.
Encode XML documents, SOAP messages, and SVG as Base64 or base64url.