JSON to XML Converter

Convert any JSON object to valid, well-formed XML. Keys starting with @ become XML attributes. Arrays become repeated elements. Runs entirely in your browser — no data leaves your device.

Developer Tools Cluster

JSON Input
📄 Drop a .json file here, or
XML Output

What This Tool Does

Converts JSON objects and arrays to well-formed XML in your browser, with configurable root element names and attribute handling. No file is uploaded.

Who This Is For

  • Developers integrating with SOAP services or legacy enterprise systems that require XML input
  • Engineers converting REST API responses to XML for systems that can't accept JSON
  • Anyone migrating data between JSON-native and XML-native formats
  • Backend developers generating XML config files from JSON data stores

Example: Input: A JSON object with nested keys and array values → Output: Well-formed XML with proper element nesting, a configurable root element, and correct escaping of special characters

How to Convert JSON to XML

  1. Paste your JSON into the input field on the left. The JSON can be an object or an array.
  2. Click Convert to XML. The XML output appears in the right panel.
  3. Click Copy to copy the XML to your clipboard.
  4. Optionally download the result as an .xml file.

The converter handles nested objects, arrays, strings, numbers, booleans, and null values. Arrays are converted to repeated XML elements. Nested objects become nested elements.

How JSON Values Map to XML

JSON TypeXML OutputExample
String / numberText content<name>Alice</name>
BooleanText content<active>true</active>
NullEmpty element<value/>
ObjectNested elements<address><city>...</city></address>
ArrayRepeated elements<item>1</item><item>2</item>

JSON keys become XML element names. Keys that start with a number or contain spaces are sanitized (spaces become underscores, numeric prefixes get an underscore prepended) to produce valid XML element names.

Why Convert JSON to XML?

To go the other direction, use the XML to JSON converter.

JSON to XML: Quick Example

Input JSON:

{
  "person": {
    "name": "Alice",
    "age": 30,
    "roles": ["admin", "editor"]
  }
}

Output XML:

<?xml version="1.0" encoding="UTF-8"?>
<person>
  <name>Alice</name>
  <age>30</age>
  <roles>admin</roles>
  <roles>editor</roles>
</person>

Array elements become repeated elements with the same tag name (the key of the array). This is the standard XML pattern for lists.

JSON and XML Workflow Tools

JSON to XML conversion fits into an API integration or legacy system workflow:

Related Tools

Related Guides & Tutorials

Frequently Asked Questions

What happens to JSON arrays?
Array elements become repeated XML elements with the same tag name. For example, "tags": ["a", "b"] becomes <tags>a</tags><tags>b</tags>.
Can I add XML attributes?
This converter produces element-based XML. JSON has no concept of attributes, so all values become element content. If you need specific attributes, edit the XML output manually after converting.
What is the root element?
The root element is derived from the top-level key of your JSON object. If your JSON is an object with a single root key, that key becomes the root element. Arrays are wrapped in a <root> element.
Does the output include an XML declaration?
Yes. The output includes <?xml version="1.0" encoding="UTF-8"?> at the top, which is required for valid XML documents.
Can I convert JSON to XML in Python?
Yes. The dicttoxml library converts Python dicts to XML. You can also use the standard library: xml.etree.ElementTree to build elements manually, or xmltodict.unparse() after installing xmltodict.
Is there a file size limit?
No hard limit. The conversion runs in your browser. Very large JSON documents may take a moment on slower devices.