JSON Beautifier

JSON to XML Converter

Convert any JSON object or array to well-formed, indented XML. Download the result directly.

Input JSON
XML Output

Turn JSON values into well-formed XML

The converter wraps the result in a root element, maps object keys to child elements, and repeats element names for array values. XML-reserved characters in values are escaped.

1

Paste valid JSON with XML-compatible key names.

2

Inspect the root wrapper and the mapping of arrays or null values.

3

Copy or download the XML document.

Before

{"name":"Alice & Bob","roles":["editor","admin"]}

After

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Alice &amp; Bob</name>
  <roles>editor</roles>
  <roles>admin</roles>
</root>
  • Supported names start with a letter or underscore and contain letters, numbers, dots, underscores or hyphens. Invalid names produce an error instead of invalid XML. Namespace-prefixed names require a separate mapping and are not supported here.
  • Keys beginning with @ represent attributes; #text represents element text. Null produces a nil="true" marker; this is a local convention, not an XML Schema xsi:nil declaration.
  • An empty array produces no repeated elements. XML does not retain all JSON type information, so use a documented mapping when a reversible conversion matters.

Need to read or debug JSON from this result? Paste it into the JSON beautifier to format, validate and explore it as a tree.

Frequently Asked Questions

How does the JSON to XML conversion work?

JSON objects become XML elements, arrays produce repeated elements with the same tag, null values get a nil attribute, and the output is wrapped in a root element.

Is the XML output well-formed?

Yes. The output includes an XML declaration and is properly indented. It passes standard XML parsers.

What happens to JSON arrays?

Each item in a JSON array becomes a repeated XML element with the same tag name. For top-level arrays, each item becomes a child of the root element.

Need the other direction? XML to JSON →