Back to Home
Published: June 2026•By Web Util Slyce Team•6 min read
JSON to XML — Convert JSON Data to XML
Learn how JSON maps to XML with practical examples. Convert JSON to XML instantly with our JSON to XML Converter.
Basic JSON to XML Conversion
JSON keys become XML element names; values become element content.
JSON Input
{
"name": "John Doe",
"email": "john@example.com",
"age": 30
}XML Output
<?xml version="1.0" encoding="UTF-8"?> <root> <name>John Doe</name> <email>john@example.com</email> <age>30</age> </root>
Nested Objects
Nested JSON objects become nested XML elements.
JSON Input
{
"person": {
"name": "Jane",
"address": {
"city": "NYC",
"zip": "10001"
}
}
}XML Output
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person>
<name>Jane</name>
<address>
<city>NYC</city>
<zip>10001</zip>
</address>
</person>
</root>Arrays
JSON arrays typically repeat the same XML element name.
JSON Input
{
"items": [
{ "id": 1, "name": "Widget" },
{ "id": 2, "name": "Gadget" }
]
}XML Output
<?xml version="1.0" encoding="UTF-8"?>
<root>
<items>
<item>
<id>1</id>
<name>Widget</name>
</item>
<item>
<id>2</id>
<name>Gadget</name>
</item>
</items>
</root>XML Attributes (Convention)
Some converters use a special prefix (like @) to denote XML attributes.
JSON with @ prefix
{
"product": {
"@id": "p123",
"@currency": "USD",
"#text": "High-value item"
}
}XML Output
<?xml version="1.0" encoding="UTF-8"?>
<root>
<product id="p123" currency="USD">
High-value item
</product>
</root>