Output
Examples:
Last updated: 2026-09-17
Paste JSON and get formatted XML output. Keys prefixed with @_ become XML attributes. The #text key maps to element text content. Arrays generate repeated child elements. You can customize the root element name and how array items are named. All processing is local.
Numeric keys
XML element names cannot start with numbers. If your JSON has numeric keys, they are preserved in the output but the resulting XML may not be valid. Use string keys instead.
Null values
JSON null values produce empty XML elements. For example, {“name”: null} becomes
Frequently asked questions
How do I create XML attributes?
Prefix JSON keys with @_ (the default attribute prefix). For example, {"@_id": "123"} becomes id="123" on the XML element. You can customize the prefix, but @_ is the convention used by fast-xml-parser.
How are arrays converted to XML?
Each array element becomes a repeated child element. By default, array items are wrapped in <item> tags. You can customize the wrapper name. For example, {"users": [{"name": "A"}, {"name": "B"}]} becomes <users><item><name>A</name></item><item><name>B</name></item></users>.
What happens to special characters?
The converter escapes XML special characters: < becomes <, > becomes >, & becomes &, and quotes in attribute values are escaped. You do not need to pre-escape your JSON string values.
Can I set text content on an element with attributes?
Yes. Use the #text key (configurable) for text content alongside @_ keys for attributes. For example, {"@_lang": "en", "#text": "Hello"} becomes <element lang="en">Hello</element>.
What if my JSON has a single root key?
If the JSON object has exactly one top-level key, that key becomes the root XML element. Otherwise, the converter wraps the content in a configurable root element (default: <root>).