JSON to XML Converter

Need the reverse conversion?
XML to JSON Converter

JSON Input

1

XML Output

Settings

XML Conversion Options

Enter JSON data to convert to XML

Your converted data will appear here

How to convert JSON to XML

  1. Step 1 – Input JSON

    • Paste your JSON content into the left editor or drag and drop a .json file.
    • The tool automatically checks for valid JSON syntax and will flag any errors immediately.
    • Ensure your JSON has a single root object if you want a clean XML structure, otherwise a default root will be added.
  2. Step 2 – Configure XML Output

    • Root Element: Define the wrapper tag name (default: "root") for your XML document.
    • Attributes: Use the Attribute Prefix option (default: "@") to tell the converter which JSON keys should be treated as XML attributes instead of child elements.
    • Declaration: Toggle the standard <?xml ...?> header on or off.
  3. Step 3 – Convert and Export

    • The XML is generated instantly in the right panel with proper indentation and character escaping.
    • Click "Copy" to use the XML in SOAP APIs or configuration files.
    • Download the result as a .xml file for later use.
Example: JSON to XML Conversion
// Input JSON
{
  "book": {
    "@id": "bk101",
    "author": "Gambardella, Matthew",
    "title": "XML Developer's Guide",
    "price": 44.95
  }
}

<!-- Output XML -->
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <book id="bk101">
    <author>Gambardella, Matthew</author>
    <title>XML Developer's Guide</title>
    <price>44.95</price>
  </book>
</root>

Related JSON & XML tools

Frequently Asked Questions

How does JSON to XML conversion work?

JSON objects are converted to XML elements. Array items become multiple elements with the same tag name. Object properties become child elements, and you can configure attributes using the @ prefix.

What happens to JSON arrays?

Arrays are converted to multiple XML elements. For example, an array named 'items' with 3 objects becomes 3 'item' elements.

Can I customize the XML structure?

Yes! You can customize the root element name, attribute prefix, indentation, and whether to include the XML declaration.

How are special characters handled?

Special XML characters (<, >, &, ', ") are automatically escaped to ensure valid XML output.

Is my data secure?

Yes, all data processing happens entirely in your browser. Your JSON data is never sent to any server, ensuring complete privacy and security.

JSON to XML Converter Online | JSONSwiss