Developer Tools

Converters

JSON to XML Converter

Turn a JSON structure into XML.

JSON0 chars
XML

Guide & explanation

The JSON to XML Converter maps a JSON structure onto XML elements.

Mapping rules

JSONXML
ObjectNested elements; the key becomes the element name
Array {"a":[1,2]}<a>1</a><a>2</a> (repeated elements)
String / number / booleanElement text
null, empty object, empty stringEmpty element <x/>
Empty arrayOmitted

Example

{ "user": { "id": 1, "roles": ["admin", "editor"] } }
<root>
  <user>
    <id>1</id>
    <roles>admin</roles>
    <roles>editor</roles>
  </user>
</root>

Options & notes

  • Root and Array item — the wrapping element names.
  • XML declaration — insert <?xml version="1.0"?>.
  • Keys that are not valid XML element names (spaces, @, leading digit) are adjusted automatically and reported.