Skip to content
JSON Toolkit

JSON to XML Converter

Convert

Convert JSON into well-formed, indented XML in one click.

Convert JSON to XML online

Plenty of SOAP services, financial systems, and enterprise integrations still speak XML. This converter turns JSON into well-formed, indented XML — complete with an XML declaration and proper escaping — so you can hand the result to a system that does not accept JSON.

It follows the conventions that make a round-trip stable: JSON arrays become repeated sibling elements, keys prefixed with @ become attributes, and a #text key becomes an element's text content.

Safe, well-formed output

Not every JSON key is a legal XML element name. Keys with spaces or special characters are sanitized into valid names automatically, and special characters in values are escaped, so the XML you get back is always well-formed. A top-level array is wrapped in a root element with item children, the standard XML idiom for a list.

Which element becomes the XML root

XML needs exactly one root element, so the converter has to decide what that is. If your JSON is an object with a single top-level key whose value is itself an object — say { "order": { ... } } — that key becomes the root and everything nests beneath it. Anything else is wrapped in a <root> element to keep the document well-formed: an object with several top-level keys, a single key holding a plain value or an array, a bare string or number, and a top-level array, whose items land inside <root> as repeated <item> elements.

Once you know the rule, the output stops surprising you. To get a specific root tag, shape your JSON as a single-key object whose key is the tag you want — nest your fields under an invoice key and you get an <invoice> root instead of the generic <root>. Deciding it on the JSON side is almost always less work than rewriting the XML afterward.

Attributes or child elements — you decide

Both attributes and child elements can carry a value, and the shape of your JSON picks which you get: a key prefixed with @ renders as an attribute on the parent tag, and a bare key becomes a nested element. Reach for attributes when the value is short, singular metadata — an id, a currency code, a status flag — and let child elements carry anything that has structure of its own or that may repeat.

Add a #text key when a single element needs both a value and metadata: the @ keys populate the tag's attributes and #text becomes its inner text. If you are unsure which style a consumer expects, child elements are the safer default — they are easier to extend later without breaking whatever is parsing the document.

What survives a round trip — and what doesn't

The @ and #text conventions are deliberately symmetrical, so a document you produce here reads back through the XML to JSON converter onto the same shape: attributes stay attributes, text content stays text content, and repeated elements collapse back into an array. The one structural catch is an array with a single item, which comes back as a plain object, because a lone element looks no different from any other.

Types do not survive on their own. XML has no notion of a number or a boolean; every value is text, so 42 lands in the element body as the characters four and two. Going the other way, type inference in the XML to JSON tool restores real numbers and booleans, or you can switch it off to keep every value a string. Plan for that step whenever a downstream schema is strict about the difference.

Convert JSON to XML online for APIs

Plenty of integrations still expect XML rather than JSON. Convert JSON to XML online and hand the well-formed, indented result to a SOAP endpoint, a legacy service, or an XML-based config. Use the @ prefix on keys to emit attributes and a #text key for element content, and the converter keeps the structure stable enough to round-trip back with the XML to JSON tool. The step-by-step JSON conversion guide covers when XML is still the right target for legacy and enterprise systems.

JSON to XML converter online — conversion of JSON to XML

This JSON to XML converter online maps each JSON key to an XML element, nested objects to child elements, and JSON arrays to repeated sibling elements — producing well-formed, indented XML in one step. Use an @ prefix on any key to emit it as an XML attribute rather than a child element, and a #text key to set the element's text content.

The conversion of JSON to XML is useful for bridging modern REST APIs to legacy SOAP services, generating XML config from JSON data, or preparing payloads for enterprise systems that require XML. The output is properly escaped and immediately usable — paste it into a SOAP client, a config file, or back into the XML to JSON tool to confirm the round-trip.

Convert large or messy JSON to XML in the browser

The conversion runs entirely in your browser — nothing is uploaded, so a config file full of internal hostnames or a payload with customer data never leaves your machine. There is no signup wall and no paywall; paste the JSON, or load it straight from a file or a URL, and the XML is there.

Input does not have to be tidy first. Minified or awkwardly spaced JSON converts just fine, and the XML is always formatted fresh on output regardless of how the source looked. If you would rather eyeball the structure before converting, run it through the JSON formatter to expand and validate it — a stray comma or an unclosed bracket is far easier to catch there than in the converted result.

Capabilities

Everything in the JSON to XML Converter

Convert JSON to well-formed XML instantly. Handles nested objects, arrays, and attributes with clean indentation. Free, private, and fully in-browser.

Well-formed output

Valid XML with a declaration, proper escaping, and clean indentation.

Arrays to elements

JSON arrays become repeated sibling elements, the standard XML idiom.

Attribute support

Keys starting with @ map to XML attributes; #text maps to text content.

Safe element names

Keys that aren't legal XML names are sanitized automatically.

Frequently asked questions

Each array item becomes a repeated element with the same tag name — the conventional XML pattern. A top-level array is wrapped in a <root> element with <item> children.

Yes. Keys that start with @ become attributes on the parent element, and a #text key becomes the element's text content. The same convention is used by the XML to JSON converter, so round-trips are stable.

Keys with spaces or special characters are sanitized into legal XML element names (invalid characters become underscores), so the output is always well-formed.

No. Every operation runs entirely in your browser using client-side JavaScript. Your JSON is never uploaded, logged, or stored on any server — it never leaves your device.

Yes, completely free with no sign-up required. There are no usage limits, no watermarks, and no premium gate on any feature.

Keep going

Related tools