LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🏷️ JSON to XML Converter

Paste JSON and get well-formed XML — object keys become elements, arrays repeat their tag, and you choose the root name.

attributes are not generated — keys become elements

Rate this tool:
Anonymous — no account, no identifier

How the json to xml converter works

Each object key becomes an element of that name; array items repeat the parent tag; primitive values become text content with &, < and > escaped. Keys that are not valid XML names fall back to <item>. The output opens with a standard XML declaration and nests with two-space indentation.

This direction serves legacy integrations — systems and endpoints that still speak XML while your data lives as JSON. Note that the conversion generates elements only: if a target schema requires specific attributes, they need manual placement, since JSON has no attribute concept to translate from.

Frequently asked questions

How are arrays converted?

By repeating the element: {"book": [a, b]} produces two <book> elements in sequence — the standard XML idiom for lists.

Can the converter produce attributes?

No — JSON has no attributes, so everything becomes elements. Schemas requiring attributes need a post-edit or a mapping convention agreed with the consumer.

What happens to special characters?

&, < and > are escaped to their entities in text content, keeping the output well-formed regardless of the data.

What if my JSON keys contain spaces?

Invalid XML names are replaced with <item> to keep the document well-formed — rename keys beforehand if the tag names matter (the find & replace tool works on JSON text too).

Local processing?

Yes — no upload, no limits, offline-capable.

Related file converters

From the blog