JSON to XML Converter
Convert JSON to pretty XML and XML back to JSON in your browser. Arrays become repeated elements and the whole document stays on your device.
The JSON to XML Converter runs entirely in your browser. The JSON and XML you paste are converted on your device and never leave it or get uploaded to ArrayKit.
Open the XML Formatter
About JSON to XML Converter
The JSON to XML Converter turns a JSON document into clean, indented XML and parses XML straight back into JSON. Pick any root element name, and arrays collapse into repeated child elements sharing the parent key as their tag. Object keys prefixed with @ become element attributes, and a #text key supplies inline text, so you can model attribute-rich XML without leaving JSON. Switch direction to paste XML and get pretty-printed JSON, with repeated sibling tags folded into arrays and attributes surfaced as @-prefixed keys. It is handy when you wire a JSON API into a SOAP or legacy XML endpoint, build an RSS or sitemap payload, or inspect a config file. Everything runs on your device — the data you paste never leaves your browser.
Features
- Two-way conversion: JSON to pretty XML and XML back to JSON
- Configurable root element name for the JSON to XML direction
- Arrays become repeated elements sharing the parent key as the tag
- Emit attributes with @-prefixed keys and inline text with a #text key
- XML attributes and repeated siblings round-trip back into JSON arrays
- Numbers, booleans, and null are coerced so scalars survive the round-trip
- Clear error banner when the JSON or XML you paste is malformed
- Runs entirely in your browser with nothing uploaded
How to use the JSON to XML Converter
- Keep the JSON → XML tab selected and paste or load JSON
- Set a root element name, or leave it as root
- Copy the generated XML or download it as a .xml file
- Switch to XML → JSON and paste XML to get pretty JSON back
Example
Input
{ "user": { "@id": 1, "name": "Ada" } }
Output
<root>
<user id="1">
<name>Ada</name>
</user>
</root>
The @id key becomes an attribute; name becomes a child element.
Common errors & troubleshooting
- The XML output wraps everything in an unexpected <root> element. — That is the wrapper element. Type a different name in the Root element field to rename it, for example response or feed.
- A JSON key like "first name" produces a strange tag name. — XML element names cannot contain spaces or start with a digit, so invalid characters are replaced with underscores. Rename the key to a valid identifier if you need an exact tag.
- XML attributes disappear after converting to JSON. — Attributes are kept, but under @-prefixed keys such as @id. Look for the @-prefixed entries alongside the element's child keys.
- Parsing fails with a mismatched or unclosed tag message. — XML must have exactly one root element and every tag must be closed. Check for a missing </tag>, a typo in a closing tag, or stray content after the root.
Frequently asked questions
- How does this converter turn a JSON array into XML?
- Each array item is emitted as its own element that reuses the array's key as the tag name. So { "item": [1, 2] } becomes <item>1</item><item>2</item> rather than a single element containing a list.
- Can I add XML attributes from JSON?
- Yes. Any object key prefixed with @ is written as an attribute on the enclosing element, and a #text key sets that element's inline text. So { "a": { "@href": "/x", "#text": "link" } } becomes <a href="/x">link</a>.
- How do I change the wrapping root element name?
- In the JSON → XML direction there is a Root element field. Type the name you want, such as response or catalog, and the whole document is wrapped in that tag instead of the default root.
- What happens to attributes when I convert XML back to JSON?
- Attributes are read into @-prefixed keys and repeated sibling elements are folded into an array under their shared tag name, so the structure round-trips cleanly between XML and JSON.
- Are numbers and booleans preserved when parsing XML?
- Text that looks like a number, true, false, or null is coerced to the matching JSON type. Values with leading zeros, like a 01234 zip code, are kept as strings so identifiers are not mangled.
- Is my JSON or XML sent to a server?
- No. The JSON to XML Converter runs entirely in your browser. The JSON and XML you paste stay on your device and are never uploaded to ArrayKit.
Related tools
- XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
- JSON Formatter — Beautify, minify and validate JSON with error locations.
- YAML ↔ JSON — Convert YAML to JSON and back.
- JSON to CSV — Convert an array of flat JSON objects to CSV.
- NDJSON to JSON — Convert NDJSON / JSON Lines to a JSON array and back, line by line.
- JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
All ArrayKit tools