JSON to XML — Convert Objects and Arrays
Convert JSON to XML with a custom root and explicit array mapping
Runs in your browser · nothing is uploaded
Object keys become element names; array entries become item elements. Null, empty objects and empty arrays all become empty elements, so original types cannot be recovered. Invalid element names are rejected.
How to use
- Paste valid JSON.
- Choose the root element name, or keep root.
- Check how arrays and empty values are represented.
- Copy the generated XML text.
Mapping rules
Object keys become XML element names. Each array item becomes an item child, retaining its order. Ampersands, angle brackets and quotes are escaped as XML entities. Carriage returns in strings use character references. Korean, Chinese and emoji values remain Unicode text.
Null, empty objects and empty arrays all become empty elements. Primitive values have no type attributes, so this output cannot reproduce the original JSON types by itself. Names must begin with a supported letter or underscore; namespace prefixes containing colons are not supported. XML 1.0 control characters and lone surrogate code units are rejected.
Examples
{"name":"민수","tags":["中文","😀"]} creates a name element and a tags element containing two item children. {"message":"A & B"} escapes the ampersand. {"empty":null} creates an empty element.
Accuracy and limits
Duplicate keys, unsafe integers, excessive decimal precision and overflowing numbers are rejected rather than silently changing values. Quote exact identifiers and decimal quantities as JSON strings. Input is limited to one million characters and 64 nesting levels. This is a general element mapping; it does not implement a particular vendor XML schema. All processing stays in your browser.
FAQ
How are arrays represented?
Each array value becomes an item element inside the enclosing element. Array order is preserved.
Can the conversion preserve all JSON types?
No. Numbers and strings share the same text representation, and null, empty objects and empty arrays become empty elements. Keep the original JSON when round-trip fidelity matters.
Why is a property name rejected?
Object keys must be supported XML element names. Spaces, colons, emoji and leading digits are rejected. Korean and Chinese letters are supported.