Convert JSON to XML
Custom tags, attributes,
CDATA — your way.
Free JSON to XML converter. Set the root tag and item tag for arrays, use @ keys as attributes, optional CDATA wrapping. Runs entirely in your browser — your JSON never leaves your device.
Three steps — paste your JSON and get valid XML in seconds.
Paste a JSON object or array, or upload a .json file. The converter accepts any valid JSON — nested objects, arrays of objects, mixed structures. Keys prefixed with @ will automatically become XML attributes in the output.
Choose the root element name that wraps the entire output, and the item tag used for array elements. Toggle the XML declaration, select whether to escape special characters or wrap them in CDATA sections, and choose indented or minified output.
Click Convert and copy the XML to clipboard or download a .xml file. The output is well-formed XML that validates in any XML parser, XSLT processor or schema validator.
The key structural decisions when converting JSON to XML.
JSON objects map naturally to XML elements — each key becomes a child element and each value becomes the element's text content or its own subtree of child elements. The main challenge is that XML requires a single root element, while a JSON array has no root — you supply the root tag name yourself.
Arrays are the other key mapping. JSON arrays have no element name, but XML repeated elements need a tag. JSONshift uses the item tag setting — if your JSON has a key users containing an array, each element becomes a <user> (or whatever item tag you set).
Attributes are handled via the @ prefix convention — the same convention used by the XML→JSON direction in reverse. A JSON key @id becomes the XML attribute id="…" on the parent element, while non-@ keys become child elements. This makes the JSON→XML and XML→JSON conversions fully reversible.
Common workflows where XML output is required.
Modern back-ends often store data as JSON but need to communicate with legacy SOAP services that require XML payloads. Converting JSON to XML lets you build the request body without a dedicated XML library in your stack.
EDI, XBRL, HL7 and many government data standards require XML submission files. Converting a JSON data structure to XML is the first step before applying an XSLT transform or validating against an XML Schema (XSD).
Maven, Spring, Ant and many other build and framework tools use XML configuration. Converting a JSON config structure to XML lets you prototype the configuration in a more readable format before committing to the XML file.
Generating a syndication feed from a JSON data source — a blog post list, product catalogue or news feed — requires XML output. Converting the JSON to XML produces a feed structure that can be further styled with XSLT or served directly.
What each setting controls in the XML output.
| Option | Values | What it does |
|---|---|---|
| Root tag | Any valid XML name | The outermost element that wraps all output. XML requires exactly one root element — this is it. Use a descriptive name like users, feed or response rather than the generic root. |
| Item tag | Any valid XML name | The element name used for each item in a top-level JSON array, or for items in nested arrays. If your JSON root is an array of user objects, setting this to user produces <user>…</user> for each element. |
| XML declaration | Include · Omit | Include prepends <?xml version="1.0" encoding="UTF-8"?> — required by strict XML parsers and SOAP processors. Omit produces a plain XML fragment suitable for embedding in a larger document. |
| Special characters | Escape · CDATA | Escape replaces &, <, >, " and ' with their XML entities — the standard approach. CDATA wraps values containing special characters in <![CDATA[…]]> sections — preserving the raw content, useful for HTML fragments or code snippets. |
| Formatting | Pretty · Minified | Pretty indents child elements with 2 spaces per level — human-readable and easy to inspect. Minified removes all inter-element whitespace — smaller payload for transmission or storage. |
Other free converters you might need next.
JSON converted in
your browser. No upload.
The entire conversion runs in JavaScript locally. Your JSON is parsed, traversed and serialised to XML entirely in your browser — it is never transmitted to any server, never stored, and gone the moment you close the tab.
The output is well-formed XML: all special characters are escaped or wrapped in CDATA, element names are validated, and the structure follows the XML 1.0 specification. The output validates in xmllint, Saxon and any standard XML parser.
