JSON to XML Converter (Free, Runs in Your Browser)
Convert JSON to valid, nested XML — or XML back to JSON — with attribute mode, CDATA, and custom element names. 100% client-side, no upload, no signup.
What it does
Paste a JSON object, array, or API response and get back well-formed XML, ready for legacy systems, SOAP endpoints, or config files that still expect it. It also runs in reverse: paste XML and get clean, structured JSON back. Nothing you paste is ever uploaded — the conversion happens entirely in your browser tab.
How it works
JSON objects become nested XML elements, and JSON arrays become repeated sibling elements automatically, so "tags": ["red", "green"] becomes <tags>red</tags><tags>green</tags> rather than one awkward wrapper element. Keys that aren't valid XML element names — ones with spaces, a leading digit, or a reserved xml prefix — are automatically renamed, and every rename is listed underneath the output so nothing silently changes shape on you.
Flip on attribute mode and the converter follows the same @key / #text convention used by libraries like fast-xml-parser: a key prefixed with @ becomes an XML attribute instead of a child element, and a #text key becomes the element's text content. That means a JSON shape like {"@id": "42", "#text": "Widget"} converts to <item id="42">Widget</item> — and converts back the same way if you paste that XML into the reverse direction.
For strings containing <, &, or line breaks, you can choose to wrap them in a CDATA section instead of escaping every character, which keeps things like embedded HTML snippets readable in the output.
How to use it
- Paste your JSON (or drop a
.jsonfile) into the input box — or switch the toggle to convert XML instead. - Set a root element name and, if your data has arrays, an item element name.
- Turn on attribute mode if your target system expects XML attributes rather than all-child-element XML.
- Copy the result or download it as a file.
If you just need to validate or pretty-print the JSON itself first, the JSON formatter will catch syntax errors with exact line and column numbers before you convert anything. And if you're deciding which of two API responses to convert, the JSON diff tool will show you exactly what changed between them.
Supported formats
- Any valid JSON: objects, arrays, strings, numbers, booleans,
null, and any nesting depth - XML output with optional declaration, CDATA sections, and attribute-mode conversion
- Reverse direction (XML → JSON) uses your browser's own built-in XML parser, so malformed XML is reported with a real parser error rather than silently guessed at
FAQ
Does this handle arrays of arrays, like a matrix?
Yes — nested arrays are wrapped using your chosen "item element name" at each level so the structure survives the round trip, rather than flattening into one confusing list of siblings.
What happens to a JSON key that isn't a legal XML tag name (like "123 bad key!")?
It's automatically sanitized into something like _123_bad_key_, and the renamed keys are listed right below the output so you can see exactly what changed.
Will converting JSON to XML and back give me the same data?
With attribute mode on, yes — for typical shapes. Since JSON has types (numbers, booleans) and XML doesn't, values come back as strings after a round trip, the same limitation every JSON↔XML converter has.
Is there a size limit?
No hard limit — it's all processed in memory in your browser, so very large documents are limited only by your device's memory, not by an upload cap.
Can I use this offline?
Yes. The whole tool is a static page with no external requests once it's loaded, so it keeps working without an internet connection.
More Text & Dev tools
- JSON-LD Schema GeneratorArticle, product, FAQ, local business and more.
- JSONPath TesterRun JSONPath queries live with highlighted matches.
- JWT Builder & SignerCreate and sign HS256, RS256 and ES256 tokens locally.
- JWT decoderBreak a JWT down into header, payload, and signature.
- Line ToolsAdd a prefix/suffix to each line, filter lines by content (plain text or regex), or repeat text across lines — with live preview, saved drafts, and file import.
- Log AnalyzerPaste raw logs and get error counts, recurring patterns, and a timeline breakdown.