Skip to content
XUtilHub

JSON to XML Converter Online

Convert JSON to well-formed XML online. Choose the root element name and indentation. Free and runs in your browser.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Input
Output

About the JSON to XML

Convert JSON objects and arrays to indented, well-formed XML. Arrays become repeated elements, and keys are sanitized into valid XML tag names.

Key features

  • Converts any JSON to well-formed, indented XML
  • Custom root element name
  • Arrays become repeated elements
  • Invalid tag names are sanitized automatically
  • Special characters are escaped (&, <, >, ")
  • Download as a .xml file

Why convert JSON to XML?

JSON dominates modern web APIs, but XML is still everywhere in enterprise systems: SOAP services, banking and payment integrations, government data exchanges, RSS feeds, Android resources, Microsoft Office formats and many legacy platforms. When you have JSON data and need to feed it into one of these systems, you need a reliable conversion.

Conversion rules

JSONXML
Object {"a": 1}<a>1</a> inside the parent
Nested objectNested elements
Array "tag": ["x","y"]<tag>x</tag><tag>y</tag>
String with & or <Escaped as &amp; / &lt;
null<key/>
true / numbersText content true / 42
Top-level array<root><item>…</item></root>

Example

{
  "order": {
    "id": 1001,
    "customer": "Ada",
    "items": [
      { "sku": "A1", "qty": 2 },
      { "sku": "B7", "qty": 1 }
    ]
  }
}

becomes

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <order>
    <id>1001</id>
    <customer>Ada</customer>
    <items>
      <sku>A1</sku>
      <qty>2</qty>
    </items>
    <items>
      <sku>B7</sku>
      <qty>1</qty>
    </items>
  </order>
</root>

Common use cases

  • SOAP and legacy APIs that accept only XML bodies.
  • Data feeds for marketplaces, product catalogues or partners that require XML.
  • Configuration for Java/Spring, .NET and Maven tools.
  • Archiving data in formats that XML schemas can validate.

Tips

  • Choose a meaningful root. Name the root element after your data (orders, catalog) instead of root.
  • Pluralization. Repeated elements use the array's key. If your target schema expects <item> children inside <items>, restructure the JSON first (e.g. "items": {"item": [...]}).
  • Validate the input. Invalid JSON is reported with the error position. Fix it with the JSON Fixer.

Converting to a config format? Try JSON to YAML or JSON to TOML. For tabular data, JSON to CSV is usually a better fit than XML.

How to use the JSON to XML

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The XML appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

How are JSON arrays represented in XML?

Each array item becomes a repeated element with the array's key as its tag name. For example, "tags": ["a","b"] becomes <tags>a</tags><tags>b</tags>. A top-level array is wrapped in the root element with <item> children.

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

Characters not allowed in XML names (spaces, @, #, etc.) are replaced with underscores, and names that start with a digit get an underscore prefix, so "first name" becomes first_name and "1st" becomes _1st.

How is null converted?

null becomes an empty self-closing element, e.g. <middleName/>.

Does it produce XML attributes?

No. Every JSON property becomes a child element. That's the most predictable mapping and works with any XML consumer.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools