JSON to XML Converter

Convert JSON into well-formed XML, with a configurable root element and arrays mapped to repeated elements.

Input (JSON)
Loading editor…
XML Output
Loading editor…
Size: 0 bytesLines: 0

Related Tools

Learn more about the JSON to XML Converter

Convert JSON to XML

JSON and XML both represent structured, nested data, but XML requires a single root element wrapping everything else — a concept JSON has no equivalent for. This tool maps every JSON object key to a same-named XML element, turns array items into repeated sibling elements under their field's tag, and lets you choose the root element name yourself.

Special characters (&, <, >, ", ') are escaped automatically, and any JSON key that wouldn't be a valid XML tag name — starting with a digit, containing a space, etc. — is sanitized so the output is always well-formed XML, not just XML-shaped text.

Runs entirely in your browser; paste JSON or drag and drop a .json file.

Why Convert JSON to XML?

Legacy System Integration

Older enterprise systems, SOAP-based services, and some banking or government APIs still only accept XML, even when everything upstream is JSON-native.

Config and Feed Formats

Some CI tools, RSS/Atom feeds, and configuration formats (like Maven POMs or Android manifests) are XML by convention, so converting a JSON payload into that shape saves hand-writing it.

Interop Testing

When integrating with an XML-based partner API, converting a sample JSON payload to XML is a quick way to sanity-check the shape you’ll need to send.

Example

The array under items becomes two repeated <items> elements rather than a single element with indexed children.

JSON
{
  "status": 200,
  "data": {
    "id": "ord_9F3K2",
    "items": [
      { "sku": "A1", "qty": 2 },
      { "sku": "B7", "qty": 1 }
    ]
  }
}
XML
<root>
  <status>200</status>
  <data>
    <id>ord_9F3K2</id>
    <items>
      <sku>A1</sku>
      <qty>2</qty>
    </items>
    <items>
      <sku>B7</sku>
      <qty>1</qty>
    </items>
  </data>
</root>

Features

Nested Objects → Nested Elements

Every object key becomes a child XML element, at any depth of nesting.

Arrays → Repeated Elements

Each array item becomes its own sibling element under the field’s tag name.

Configurable Root Element

Name the single root tag XML requires — JSON has no equivalent concept, so you choose it.

Well-Formed by Construction

Special characters are escaped and invalid tag names are sanitized automatically, then verified.

Upload a File

Drag and drop or upload a .json file to convert it directly, no copy-pasting required.

Download

Save the result as a standalone .xml file for use in your project.

How to use

Paste your input in the left editor. The output appears automatically on the right. Use the toolbar buttons to copy, download, or transform the result.

  1. Paste or type your content in the input editor on the left.
  2. The formatted output is generated automatically.
  3. Use Copy, Download, or other actions from the output toolbar.
  4. Click the expand icon to view the output in fullscreen.
FAQ

Is this JSON to XML converter free?

Yes, it is completely free to use with no limits, signup, or account required.

Is my JSON uploaded to a server?

No. All conversion happens entirely in your browser using JavaScript. Your JSON is never uploaded or sent to a server.

How are JSON arrays converted?

Each array item becomes its own sibling XML element under the field’s tag name, e.g. a JSON "items" array with two entries becomes two separate <items> elements, not one element with indexed children.

How are nested objects handled?

Every object key becomes a child XML element, at any depth of nesting, mirroring the JSON structure.

Why do I need to choose a root element name?

XML documents require exactly one root element wrapping everything else, a concept JSON has no equivalent for. Since JSON has no built-in name for this, you choose it — it defaults to "root".

Are special characters escaped?

Yes. &, <, >, ", and ' are escaped as XML entities wherever they appear in text content, so the output stays well-formed even when your data contains them.

What happens if a JSON key isn’t a valid XML tag name?

Keys that start with a digit, contain spaces, or use other characters XML tag names don’t allow are automatically sanitized (invalid characters become underscores) so the output is always well-formed XML.

Can I upload a file instead of pasting?

Yes. Drag and drop or use the upload button to load a .json file.

Can I download the converted XML?

Yes, use the Download button to save the result as a standalone .xml file.