JSON ↔ XML
Free online JSON ↔ XML converter. Convert between JSON and XML formats in either direction. All processing happens locally in your browser.
How to Use JSON ↔ XML
Paste Your Data
Paste JSON or XML data into the input panel. The tool detects which format you have and suggests the conversion direction.
Choose Direction
Click "JSON → XML" to convert JSON to XML, or "XML → JSON" to convert XML to JSON.
Copy the Result
The converted output appears on the right. Copy it for use in your project.
Examples
JSON
{
"book": {
"title": "JSON Guide",
"author": "Jane",
"tags": ["json", "web"]
}
} XML
<?xml version="1.0" encoding="UTF-8"?>
<book>
<title>JSON Guide</title>
<author>Jane</author>
<tags>json</tags>
<tags>web</tags>
</book> Frequently Asked Questions
How does JSON map to XML?
JSON objects become XML elements. Object keys become tag names, and primitive values (strings, numbers, booleans) become text content. Arrays produce repeated elements with the same tag name. JSON root must be a single object — XML requires a single root element. XML attributes are not used; everything becomes child elements for a clean 1:1 mapping.
What about XML attributes?
This converter uses an element-only mapping for simplicity and reliability. XML attributes are inherently order-independent and can't contain nested structures, which makes them a poor match for JSON's flexible data model. When converting XML → JSON, attributes are converted to child elements prefixed with "@".
Can I convert any XML to JSON?
Most XML can be converted, but there are edge cases. XML with mixed content (text interleaved with elements) and XML with namespaces may not map cleanly. For simple data-oriented XML (like RSS feeds, sitemaps, or config files), the conversion works well.
JSON vs XML: Practical Considerations
JSON has largely replaced XML for web APIs, but XML is still everywhere — RSS feeds, sitemaps, SOAP services, office document formats (OOXML), and many enterprise systems. If you're integrating with an older service or generating an RSS feed, you'll need to convert between the two.
The conversion isn't lossless in either direction. XML has features JSON doesn't: attributes, namespaces, comments, and processing instructions. JSON has data types XML doesn't: proper number and boolean types, null. This converter makes pragmatic choices — XML attributes become child elements prefixed with "@", and JSON types are preserved as text in XML (you'll need to parse them on the other end).