JSON to XML — Converter with Attributes, Text and Repeated Elements
Transform JSON hierarchies cleanly into well-formed indented XML nodes.
- The inverse of xmltodict: "@name" becomes an attribute, "#text" text, arrays repeated elements and null an empty element. & < > and quotes are escaped, and tabs and newlines in attributes are written as 	 and so they survive.
When to use the JSON Object to XML Element Converter
The inverse of xmltodict
"@name" keys become attributes, "#text" becomes text, arrays become repeated elements and null an empty element. xmltodict reads the output back as the same data.
Safe escaping
&, <, > and quotes are escaped; tabs, newlines and CRs in attributes are written as 	, and so attribute normalisation does not erase them when the file is read again.
Names and characters checked
Keys that are not valid XML names (starting with a digit, holding spaces or empty) and control characters XML 1.0 forbids are reported with their path instead of producing broken XML.
One root element
A JSON object with one key becomes the root element directly. Other shapes, such as arrays or objects with several keys, are wrapped in a root element whose name you can set.
Frequently asked questions
How are numbers and booleans written?
Numbers are written exactly as in the JSON without rounding, and booleans as true or false.
Can it produce CDATA or comments?
No. Text is always escaped, which a parser reads exactly like CDATA.
What about keys with a colon?
Keys such as atom:link are written as prefixed element names. Add an @xmlns:atom attribute on a parent element too, so the document is valid under the namespace rules.
Why are arrays inside arrays rejected?
XML has no direct form for unnamed nested arrays. Wrap each inner array in an object with an element name.
Is my data uploaded?
No. The conversion runs in your browser.
Similar tools
- XML Document to Structured JSON ConverterParse XML tags, attributes & nested child elements into JSON objects.
- JSON Formatter & Syntax PrettifierFormat messy single-line JSON with 2/4-space indentation and sorted keys.
- JSON Minifier & Whitespace CompressorStrip whitespace and newlines from JSON payloads and compare byte savings.
- RFC 8259 JSON Syntax Validator & DebuggerPinpoint trailing commas, unquoted keys & syntax errors with line/column clues.