JSON to XML Converter

Or enter JSON manually below

Cleared

Input & Output for JSON to XML Converter

What input is accepted by this tool?

The input must be a valid JSON object with a single root key. XML requires a single root element, so your JSON must have exactly one top-level key. For example,

{
    "spreadsheet": {
        "name": "Sales Report",
        "application": "Google Sheets",
        "rows": 1500
    }
}

What'll be the output of this tool?

The output will be a well-formed XML document. For example, the output of the above input will be:

<?xml version="1.0" encoding="UTF-8"?>
<spreadsheet>
    <name>Sales Report</name>
    <application>Google Sheets</application>
    <rows>1500</rows>
</spreadsheet>

What inputs are considered invalid?

The following inputs will produce an error:

  • Invalid JSON syntax: Missing quotes, trailing commas, or malformed structures.
  • Multiple root keys: JSON with more than one top-level key, such as {"name": "Budget", "app": "Excel"}.
  • Non-object values: Arrays, strings, numbers, booleans, or null at the root level.

How do I add attributes to XML elements?

Use the $ key to define attributes and the _ key for text content when an element needs both. For example,

{
    "workbook": {
        "$": { "format": "xlsx", "app": "Excel" },
        "sheet": "Q4 Revenue"
    }
}

This produces:

<?xml version="1.0" encoding="UTF-8"?>
<workbook format="xlsx" app="Excel">
    <sheet>Q4 Revenue</sheet>
</workbook>