JSON to XML Converter

Convert JSON to XML format instantly online. Paste JSON below and click Convert.

Quick answer

A JSON-to-XML converter turns each JSON key into an element tag and each value into that element's text or nested children, wrapping everything in a root element. This tool uses 2-space indentation, expands arrays into repeated sibling elements, escapes special characters, and produces elements only (JSON has no attributes) — all in your browser, nothing uploaded. Paste JSON, click Convert to XML, then copy or download.

How This Tool Converts JSON to XML

When to Use JSON to XML

Worked example

An object with a primitive, an array, and a nested object — the three cases that show how JSON structure maps onto XML:

Input JSON

{
  "name": "John",
  "age": 30,
  "skills": ["JS", "Python"],
  "address": { "city": "Boston" }
}

Output XML

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>John</name>
  <age>30</age>
  <skills>JS</skills>
  <skills>Python</skills>
  <address>
    <city>Boston</city>
  </address>
</root>

What happened

Edge cases & gotchas

Frequently Asked Questions

How does JSON to XML conversion work?

JSON objects become XML elements. Each key becomes an element tag and each value becomes the element's text content or nested child elements. Arrays are converted to repeated elements with the same tag name. All output is wrapped in a <root> element.

Can it convert nested JSON to XML?

Yes. Nested JSON objects become nested XML elements. Arrays of objects become repeated child elements, each containing the object's properties as sub-elements.

Is my data sent to a server?

No. All conversion happens entirely in your browser using JavaScript. Your data never leaves your device.

Can I control the root element name?

The tool wraps all output in a <root> element by default. To use a custom root name, wrap your JSON in an object with the desired key before converting: {"person": {...}} produces <person>...</person>.

Are XML namespaces supported?

No. This tool generates plain XML without namespace declarations. If your target system requires namespaces, add them manually to the output after converting.

Does the converter produce XML attributes?

No. JSON has no concept of attributes, so every JSON key becomes a child element, never an attribute. Where XML could express data as either <user id="1"> or <user><id>1</id></user>, this tool always produces the element form. If your target schema requires attributes, add them to the output by hand.

Are data types preserved in the XML output?

No. XML element content is always text, so the number 30 and the string "30" both become <age>30</age>. The type information from JSON is lost — a consumer of the XML cannot tell a number from a string unless a schema (XSD) says so.