JSON to XML Converter
Convert JSON to XML online. Maps arrays to repeated elements and @keys to attributes, with a configurable root element. Runs entirely in your browser.
How it was mapped
Import from File
Drag & drop a file here
or
Supports .txt, .csv, .log, .json and other text files
All conversion happens locally in your browser. No data is sent to any server. Your JSON stays completely private.
What It Does
This tool rewrites JSON as XML — the format still used by SOAP services, RSS and Atom feeds, sitemaps, office documents, and many enterprise APIs. Objects become nested elements, arrays become repeated elements that share the parent's tag name, and scalar values become the text inside each element. Because XML must have exactly one root, everything is wrapped in a root element whose name you choose. The tool also supports the two things people most often need when generating real XML: attributes and text. Any key you prefix with @ becomes an attribute, and a #text key becomes the element's text, so you can produce markup like <book id="bk101">Dune</book> rather than being limited to elements only. It then explains exactly how it mapped your data — how many arrays it expanded, how many attributes it created, and any keys it had to rename to stay valid XML — so there are no surprises.
When to Use It
- You have a JSON API response and need to feed it into a legacy system, SOAP endpoint, or tool that only accepts XML.
- You're generating an RSS/Atom feed, sitemap, or config file from JSON data and want clean, indented XML.
- You need attributes in the output (id, type, lang) and want a converter that supports them via the @ convention rather than elements only.
- You want to see exactly how nested arrays and objects map to repeated elements before wiring up the conversion in code.
Worked Examples
{"note":{"to":"Ada","from":"Alan","body":"Hello"}}
A simple object becomes nested elements: <note> containing <to>, <from> and <body>. This is the plain element-only mapping.
{"library":{"book":[{"title":"Dune"},{"title":"Foundation"}]}}
The book array is expanded into two repeated <book> elements inside <library> — the standard way arrays map to XML.
{"book":{"@id":"bk101","@lang":"en","#text":"Dune"}}
The attribute case: @id and @lang become attributes and #text becomes the element text, producing <book id="bk101" lang="en">Dune</book>.
Features
How to Use
1. Paste or upload JSON in the input area. 2. Optionally set the root element name, indentation, and whether to include the XML declaration. 3. The XML appears instantly, with a panel explaining how arrays and attributes were mapped. 4. Click Copy or Download to save the result.
Common Mistakes
- Expecting a JSON array to become a single XML element. Arrays become repeated sibling elements sharing the parent tag name — there is no wrapper element per array unless you add one in the JSON.
- Using keys with spaces or leading digits and expecting valid XML. Those aren't legal element names; the tool renames them, but it's better to fix the source key if the exact name matters.
- Forgetting XML needs one root. A top-level array or multiple top-level keys are all placed inside the single root element — set the root name to something meaningful.
- Assuming attributes appear automatically. Only keys you prefix with @ become attributes; everything else becomes an element.