JSON to XML Converter
Paste your JSON below and get XML instantly. The conversion happens entirely on your device — nothing is uploaded — so it's safe for private data and works offline once loaded.
Example: JSON → XML
JSON in
{
"name": "CalcCafe",
"tools": ["json", "yaml"]
}XML out
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>CalcCafe</name>
<tools>json</tools>
<tools>yaml</tools>
</root>
How it works
The converter parses your JSON into an in-memory data structure, then serialises that structure as XML. Because both steps run client-side in JavaScript, conversion is instant and your data never touches a network. The same engine powers every JSON / YAML / XML / CSV pairing, so results stay consistent across directions — you can round-trip JSON → XML and back without surprises.
Tips for clean XML
- Use the From / To selectors to switch formats, or the ⇄ button to reverse the conversion and reuse the output as input.
- Set the indent to match your project's style (2 or 4 spaces).
- Invalid input shows a clear error message pointing at the problem instead of failing silently.
Good to know
This JSON to XML Converter turns a block of JSON into well-formed XML directly in your browser. It's aimed at developers and integrators who need to feed JSON-shaped data into systems that still speak XML — think SOAP web services, legacy enterprise APIs, RSS/Atom feeds, configuration files, or XML-based document pipelines. Because the parsing and serialisation both happen on your device, you can paste internal API responses or sensitive payloads without them ever being uploaded.
Reach for it when you have working JSON but a downstream consumer expects XML, when you're sketching out an XSD or transform and need sample markup quickly, or when you want to sanity-check how a particular JSON shape maps to elements before wiring it into code. The live editor means you can tweak the input and watch the XML update, which is handy for testing edge cases like nested objects, empty values, or deeply repeated arrays.
Read the output as a direct structural mapping: each object key becomes an element, nested objects become nested elements, and every item in an array is emitted as a repeated element sharing the parent key's name. Since XML requires exactly one top-level element, a wrapping <root> is added when your JSON's outermost value is an array or has multiple keys. You also get control over the result through key conventions — a key prefixed with @ is rendered as an attribute, and a #text key fills an element's text content.
One practical caveat: JSON and XML don't model data identically, so the conversion isn't always perfectly reversible. JSON distinguishes numbers, booleans, and null, but XML treats everything as text, so 42 and "42" both become the same element text — round-tripping back to JSON can therefore lose those type distinctions. Also keep tag names valid: JSON keys with spaces, leading digits, or special characters aren't legal XML element names, so clean those up in your input before relying on the markup elsewhere.
Frequently asked questions
How are JSON arrays represented in XML?
Each array item becomes a repeated element with the same tag name. A top-level array is wrapped in a <root> element with <item> children so the XML has a single valid root.
Can I produce XML attributes?
Yes — prefix a key with @ (for example "@id") and it becomes an attribute on the parent element. A "#text" key sets the element's text content.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser using JavaScript — your data never leaves your device and nothing is sent to a server.
Is this converter free?
Yes, completely free with no sign-up, and no limits. It even works offline once the page has loaded.
People also ask
What is the difference between JSON and XML?
JSON is a lightweight data format that uses key-value pairs, arrays, and a small set of types (string, number, boolean, null, object, array). XML is a markup language that uses nested tags and attributes and treats all content as text, making it more verbose but able to carry metadata via attributes and namespaces.
Why would I convert JSON to XML instead of just using JSON?
You typically convert to XML when a target system requires it — for example SOAP services, older enterprise APIs, RSS/Atom feeds, or tooling built around XSLT and XML schemas. JSON is often easier to work with, but XML remains the expected format in many established integrations.
How do nested JSON objects appear in the XML output?
Each nested object becomes a nested set of elements: the parent key becomes a containing element, and the object's own keys become child elements inside it. The nesting depth in the XML mirrors the nesting depth in your JSON.
Does converting JSON to XML preserve data types like numbers and booleans?
No. XML stores all values as text, so a JSON number, boolean, or null becomes plain element text in the XML. If you convert that XML back to JSON, those values may come back as strings unless you re-cast them.
What happens to a JSON null value when converted to XML?
A null typically becomes an empty element with no text content, since XML has no native null type. Whether it is treated as an empty string or a missing value depends on how the consuming system interprets empty elements.
Can I convert XML back to JSON after using this tool?
Yes, CalcCafe offers a separate XML to JSON converter for the reverse direction. Be aware that a full round-trip may not reproduce the original JSON exactly because of type and structural differences between the two formats.
Is there a file size limit for converting JSON to XML here?
There is no enforced server limit because everything runs in your browser. Very large inputs are bounded only by your device's available memory and the browser's processing speed.
Will the converted XML include an XML declaration?
Yes, the output begins with a standard declaration such as <?xml version="1.0" encoding="UTF-8"?> followed by a single root element wrapping your data.
Related converters