Blog

How to Convert JSON to XML

Convert JSON to XML and back — how objects map to elements, how arrays and attributes are handled, and a free online JSON to XML converter.

Many legacy systems, SOAP APIs, and enterprise tools still speak XML. Converting JSON to XML (and back) bridges modern and legacy stacks.

How the mapping works

A JSON object becomes XML elements, where each key is a tag:

json
{ "user": { "name": "Alice", "age": 30 } }

becomes

xml
<user>
  <name>Alice</name>
  <age>30</age>
</user>

Arrays

A JSON array becomes repeated elements with the same tag name:

json
{ "tags": ["a", "b"] }
xml
<tags>a</tags>
<tags>b</tags>

The mismatch challenges

JSON and XML aren't perfectly equivalent:

  • Attributes — XML has them (<user id="1">), JSON doesn't. Converters often use a convention like @id.
  • Order — XML cares about element order; JSON objects technically don't.
  • Text + children — XML elements can have both; JSON needs a convention (e.g. #text).

JSON vs XML

Wondering which to use in the first place? See JSON vs XML.

Convert online

Paste JSON or XML into the JSON to XML converter to transform it in either direction, instantly and locally.

Got a file to check?
Paste it in. Errors come back in plain English.
Open JSON ↔ XML Converter →