Loona Automation logoLoona Developer Tools
Home › Data Converters

JSON to XML Converter

In short: turn JSON into well-formed XML: choose the root element name, nested objects become nested elements, arrays become repeated elements, and keys starting with @ become attributes.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

{"person": {"name": "Ali", "age": 30}}

Output:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <person>
    <name>Ali</name>
    <age>30</age>
  </person>
</root>

About this converter

JSON and XML model data differently — JSON has arrays and types, XML has attributes and text — so every converter makes conventions, and this one documents its own: object keys become element names; an array under a key repeats that element; a key starting with @ becomes an attribute of its element; #text sets text content alongside children. Values are XML-escaped. The mapping round-trips with this site's XML to JSON converter, which uses the mirror-image conventions. Element names must be valid XML names (letters, digits, - _ . after the first character) — JSON keys with spaces or slashes need renaming first, which is a real constraint of XML itself, not of this tool.

Frequently Asked Questions

How are arrays converted?

As repeated elements with the same tag: {"b": [1, 2]} becomes <b>1</b><b>2</b>.

Can I control attributes?

Yes — prefix a key with @ inside an object and it becomes an attribute of that element instead of a child element.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.