Skip to content
JsonSucks
← Back to the formatter

Convert JSON to XML

Paste, upload, or drop JSON on the left — well-formed, indented XML appears live on the right as you edit. Copy or download it, no separate convert step.

Actions▾

JSON to XML, always well-formed

JSON and XML both represent nested, structured data, but XML requires a single root element and has no native array syntax — two things this converter handles for you automatically. If your JSON is a single object with one top-level key, that key becomes the root element; otherwise, the whole document is wrapped in a<root> element so the result is always valid, parseable XML. Arrays become repeated sibling elements with the same tag name, the standard convention most JSON-to-XML tools follow.

The conversion is live — edit the JSON on the left and the XML on the right updates as you type, indented to match whatever indent width you've set (2, 3, 4 spaces, or a tab), with a proper <?xml version="1.0" encoding="UTF-8"?> declaration at the top. Copy it to the clipboard or download it as a .xml file directly from the preview panel.

Need CSV or YAML instead? The same document converts live toCSV orYAML too — just switch the "View" dropdown.

What root element does the XML output use?

If your JSON is a single object with exactly one top-level key, that key becomes the root element — e.g. { "user": {...} } produces <user>...</user>. Otherwise (an array, or an object with multiple top-level keys), everything is wrapped in a generic <root> element so the output is always well-formed XML with exactly one root.

How are JSON arrays represented in XML?

XML has no native array syntax, so each item in a JSON array becomes a repeated sibling element with the same tag name — the standard convention most XML-from-JSON tools use, and the same one this converter's parser reads back correctly.

Does it include an XML declaration?

Yes — the output starts with <?xml version="1.0" encoding="UTF-8"?>, and the indent width matches whatever you've set in the toolbar (2, 3, 4 spaces, or a tab).

Can I convert XML back to JSON?

This page is focused on the JSON → XML direction. The same underlying parser can read XML attributes and text nodes back into JSON, and that direction may get its own dedicated page in a future update.