JSON to XML
Convert JSON into an XML document.
Everything runs inside your browser. Your files never leave your device.
Input
Result
Ask about JSON to XML
Questions about what this tool does, which option to pick, or what it can and cannot handle.
The question you type here is sent to an AI provider to be answered — your files and whatever you put in the tool above are not, and the assistant cannot see them. Answers are generated and can be wrong. The tool itself is not guessing: it runs deterministic code on your device.
About the JSON to XML
Converting JSON into XML is usually driven by something at the other end that will not accept anything else — an enterprise system, a legacy API, a SOAP endpoint, a specified interchange format.
The conversion has to invent things, and it is better to know what. JSON has no root element and XML requires exactly one, so a name has to be supplied. JSON arrays have no equivalent structure at all, so each element becomes a repeated child element and the array itself disappears. JSON keys can contain characters that are illegal in XML element names — spaces, leading digits, hyphens in some contexts — so those are sanitised.
Numbers, booleans and nulls all become text, because XML has no types without a schema. A boolean true becomes the string "true", and whatever reads the document has to know to interpret it. Null becomes an empty element, which is the conventional representation and is indistinguishable from an empty string, which is one of the reasons round-tripping through XML and back does not return what you started with.
Element names are derived from keys, with a fallback for array items since the array's own key names the collection rather than each member. The output is indented, and characters that would be markup are escaped.
If the receiving system has an XSD, check the result against it before assuming the shape is right. A conversion can only produce a reasonable structure; it cannot produce the specific structure someone else's schema demands, and the two are rarely the same on the first attempt.
How to use it
- 1Paste the JSON you need converted.
- 2Set the root element name, since XML requires one and JSON does not provide it.
- 3Check how arrays came out — each element becomes a repeated child, and the array itself has no representation.
- 4Validate the result against the receiving system's schema before sending it anywhere.
Questions
- Why do I have to name a root element?
- Because an XML document must have exactly one, and JSON has no equivalent. A JSON object with three top-level keys has three roots as far as XML is concerned, so one has to be supplied to contain them.
- How are arrays represented?
- Each element becomes a repeated child element and the array itself disappears. XML has no array construct, so a list of three items is simply three sibling elements of the same name.
- What happens to numbers and booleans?
- They become text, because XML has no types of its own without a schema. The consumer has to know that a particular element holds a number, which is what an XSD is for.
- Can I convert back to the original JSON?
- Not exactly. Types are gone, a null and an empty string look identical, and a single-element array is indistinguishable from a plain value. The round trip loses information in both directions.

