Skip to content
MyDailyTool

JSON to XML Converter

Convert JSON objects and arrays to well-formed XML. Maps object keys to elements, array items to repeated elements, with optional root wrapper.

How to use the json to xml converter

Paste JSON on the left. Well-formed XML appears live on the right. Object keys become element names; nested objects become nested elements; array items become repeated elements.

Formula & explanation

We map { key: value } to <key>value</key>. Arrays render as repeated elements. Keys starting with "@_" become attributes on the parent (matches fast-xml-parser's convention).

Examples

{"book":{"@_id":"1","title":"Demo"}} becomes <book id="1"><title>Demo</title></book>

Frequently asked questions

How do I produce attributes instead of child elements?
Prefix the key with @_ — e.g. {"book": {"@_id": "1", "title": "x"}} produces <book id="1"><title>x</title></book>. This matches the fast-xml-parser convention.
What if my root is an array?
XML requires a single root element. We wrap arrays in <root><item>…</item></root> automatically. Wrap them yourself in a named root if you want a specific element name.
Are XML namespaces supported?
Yes — include them as attributes (e.g. "@_xmlns": "http://example.com"). The output is namespace-aware but we don't auto-generate prefixes.

Related developer tools tools