Convert JSON to XML or XML to JSON in your browser. Pick a direction, paste your data and get the result instantly, with a swap button to round-trip the output. Nothing is uploaded.
JSON
{
"user": {
"id": 1,
"name": "Alice",
"tags": ["a", "b"],
"address": { "city": "NYC" }
},
"active": true
}XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
<user>
<id>1</id>
<name>Alice</name>
<tags>a</tags>
<tags>b</tags>
<address>
<city>NYC</city>
</address>
</user>
<active>true</active>
</root>
JSON has one top-level value, but XML needs a single root element, so the result is wrapped in <root>. Object keys become elements, and each item of an array becomes a repeated element with the same name.
XML
<user id="1">
<name>Alice</name>
<tags>a</tags>
<tags>b</tags>
</user>JSON
{
"user": {
"name": "Alice",
"tags": [
"a",
"b"
],
"@_id": "1"
}
}@_, so id="1" becomes "@_id"."1", not 1), so convert types yourself if you need strict numbers.JSON is shorter and maps directly to objects and arrays in most languages, which is why web APIs prefer it. XML adds attributes, namespaces and mixed content, and is still common in enterprise systems, SOAP services, RSS feeds and configuration. See JSON vs YAML vs XML: which format should you use for guidance.
Convert to YAML or CSV, validate with the JSON Schema generator, or fix invalid JSON first with JSON Repair.
Each JSON key becomes an XML element, arrays become repeated elements, and primitive values become text content. The converter handles nested objects, arrays, and special characters with proper XML escaping.
The converter focuses on element-based XML. When converting XML to JSON, attributes are prefixed with @ in the JSON output. This convention allows round-trip conversion while preserving attribute data.
Common scenarios include integrating with legacy SOAP APIs, generating XML feeds (RSS, Atom), creating XML configuration files, and working with systems that require XML input like some enterprise platforms.