How to use the json to xml converter
- Paste your JSON into the left panel — a working example is preloaded.
- If your top-level JSON is an array or a single value, set the root element name to wrap it.
- Adjust the attribute prefix and pretty-print if needed.
- Read the converted XML on the right, updated live as you type.
How it works
This converter uses the same convention as the XML to JSON converter, in reverse: keys prefixed with @_ become XML attributes, and a #text key becomes element text content. If your JSON's top level is a plain object (like the output of the XML to JSON converter), its keys become root-level XML tags directly — this is what makes round-tripping between the two converters exact. If your top level is an array or a single value instead, it gets wrapped in the root element name you specify, since XML always needs a named container.
Examples
| Input | Result |
|---|---|
| {"note":{"to":"Tove","from":"Jani"}} | <note><to>Tove</to><from>Jani</from></note> |
| [1, 2, 3] with root name "list" | <list>1</list><list>2</list><list>3</list> |
Frequently asked questions
Is my JSON uploaded anywhere?
No — the conversion happens entirely in your browser.
How do I set the root element?
If your JSON top level is already an object (e.g. {"note": {...}}), its key is used as the root tag directly and the "Root element name" field is ignored. If your top level is an array or a plain value, that field names the wrapper element.
How do JSON arrays map to XML?
Each item in an array becomes a repeated XML tag with the same name — the inverse of how the XML to JSON converter groups repeated tags into arrays.
Can I change how attributes are written?
Yes — the attribute prefix defaults to @_ (matching the XML to JSON converter's convention) but you can change it to anything you like.
What happens if my JSON is invalid?
You get the exact SyntaxError message from the JSON parser so you can find and fix the problem.
Related tools
XML to JSON Converter
Paste XML and get clean, formatted JSON instantly — parsed with a real XML parser, not regex.
YAML to JSON Converter
Paste YAML and get clean, formatted JSON instantly — including multi-document files and anchors.
Sitemap Validator
Paste your sitemap XML to validate it against the sitemaps.org protocol — catch broken URLs and bad values before Google does.