JSON to XML Converter

Convert a JSON document into well-formed, indented XML. Object keys become element names, arrays become repeated elements, and special characters are escaped correctly.

json-to-xml · runs locally

What this JSON to XML converter does

Plenty of systems still require XML: SOAP services, enterprise integrations, RSS feeds, sitemaps, invoicing standards and legacy imports. When your data lives in JSON, this converter produces the XML those systems expect — object keys become element names, nesting becomes element hierarchy, arrays become repeated elements, and every value is escaped so the document is guaranteed well-formed.

The output includes the standard XML declaration and two-space indentation, ready to paste into a file or request body.

How to convert JSON to XML

  1. Paste your JSON into the input box.
  2. Click Convert to XML.
  3. Copy the well-formed XML output into your integration or file.

The mapping, made explicit

JSON and XML have different data models, so the converter follows the most widely used conventions: null becomes a self-closing empty element, booleans and numbers become text content, and a top-level array is wrapped in <root> with <item> children. If the receiving system publishes a schema (XSD), compare the output against it — element naming is the usual thing to adjust. Curious how the formats compare beyond mechanics? The JSON vs XML vs YAML guide covers the trade-offs.

Frequently asked questions

How are JSON arrays represented in XML?

As repeated elements with the same name — the standard XML idiom. A JSON property "tags": ["a", "b"] becomes two <tags> elements. A top-level array is wrapped in a <root> element with one <item> per entry, since XML requires a single root.

What happens to JSON keys that aren't valid XML names?

XML element names can't contain spaces or most punctuation and can't start with a digit. Invalid characters are replaced with underscores and a leading underscore is added where needed, so "first name" becomes <first_name> and "2fa" becomes <_2fa>.

Are special characters escaped?

Yes. The characters &, < and > in values are escaped to &amp;, &lt; and &gt; as the XML specification requires, so the output is always well-formed regardless of what your strings contain.

Does the conversion use XML attributes?

No — everything becomes elements. JSON has no concept that maps cleanly onto attributes, and element-only output is unambiguous, easier to parse and easier to convert back. If a target schema requires attributes, adjust the output to match it.