What is a JSON to XML converter?
JSON and XML are two ways of writing the same thing: structured data. JSON is the format of modern APIs; XML is the format of older systems, config files, and feeds. When one side speaks JSON and the other side speaks XML, something has to translate — and that is what this converter does.
The translation is straightforward. A JSON object becomes an XML element, each key becomes a child element, and each value becomes the text inside it. The default text on this page, {"name":"Ada","age":36}, becomes <root><name>Ada</name><age>36</age></root> — three elements, one level deep, carrying exactly the same data.
Arrays need a small decision, because XML has no array type. This converter repeats the element: a list of two tags becomes two elements with the same name, one after the other. That is the convention most XML systems expect, and it round-trips cleanly back to a JSON array.
Everything runs in your browser. Your data never leaves your device, nothing is uploaded or stored, and there is no account to create. You can convert sensitive records — customer data, private config, internal payloads — without worrying about who else sees them.
How JSON becomes XML
The converter parses your JSON first. If the input is invalid, it reports the error instead of guessing — a broken block cannot become valid XML. Once parsed, it walks the data structure and writes XML as it goes, wrapping the whole thing in a <root> element so the result is always a single well-formed document.
Objects map to elements. Each key becomes a tag name, and the value becomes whatever sits inside the tag: text for strings and numbers, child elements for nested objects, repeated elements for arrays. The key order from the JSON is preserved, so the XML reads in the same order as the data it came from.
Values map by type. A string becomes text, with the characters <, >, and & escaped so the XML stays valid. A number or a boolean becomes its plain text form. A null becomes a self-closing tag, like <middle/> — an element with no content, which is the honest XML way to say 'this value is empty'.
The depth number tells you how nested the result is. The default block has depth 1 — a flat object. A nested block like {"user":{"name":"Ada","tags":["dev","uk"]}} has depth 3, and its XML has 5 elements: root, user, name, and two tags elements. The deeper the JSON, the deeper the XML.
The mapping rules, in plain language
Arrays become repeated elements with the same tag name. {"tags":["dev","uk"]} becomes <tags>dev</tags><tags>uk</tags> — two elements, no wrapper, no index numbers. That is the standard convention, and it is what the XML side of most systems expects to receive.
A top-level array has no key to name its elements, so the converter uses the root name. ["a","b"] becomes <root>a</root><root>b</root> — two root elements, one per item. It is unusual, but it is the only honest mapping, and it is better than inventing a key name you did not ask for.
Key names are cleaned up for XML. A key with a space or a special character, like "first name", becomes <first_name> — the space turns into an underscore. A key that starts with a digit gets an underscore in front of it, because XML tag names cannot start with a digit. The data is unchanged; only the tag spelling is adjusted to fit XML rules.
Escaping protects the data. A value like "a < b & c > d" becomes <note>a < b & c > d</note> — the angle brackets and the ampersand are written as entities so the XML parser reads them as text, not as markup. Without escaping, that value would break the document.
A worked example: a user record, converted
Start with the default block: {"name":"Ada","age":36}. The converter produces <root><name>Ada</name><age>36</age></root> — 3 elements, depth 1. Every key became an element, every value became text, and the whole thing sits inside <root>. Paste that XML into any XML tool and it parses cleanly.
Now a nested block: {"user":{"name":"Ada","tags":["dev","uk"]}}. The result is <root><user><name>Ada</name><tags>dev</tags><tags>uk</tags></user></root> — 5 elements, depth 3. The object under user became a <user> element, and the two-item array became two <tags> elements. Read it out loud and it says the same thing as the JSON.
Try a value that needs escaping: {"note":"a < b & c > d"}. The output is <root><note>a < b & c > d</note></root> — 2 elements, depth 1. The <, the &, and the > are all escaped, so the XML stays valid and the original text can be recovered exactly by any XML parser.
Finally, try broken input: {"a":}. The converter reports invalid JSON instead of producing XML. There is no honest way to convert a block that does not parse, so the tool refuses and shows the error. Fix the input and convert again — the error message tells you where the problem is.
Who converts JSON to XML, and why
Developers integrating with older systems are the biggest users. Banks, government portals, and enterprise software still speak XML, while modern apps speak JSON. When a new app has to talk to an old system, the data has to cross the format gap — and a converter does it in seconds instead of an afternoon of hand-writing.
Testers are the second group. They build XML payloads to feed into legacy endpoints, and writing XML by hand is slow and error-prone. It is faster to write the data as JSON, which is easier to type, and convert it — the converter handles the brackets, the escaping, and the nesting.
Data workers are a third group. Feeds, exports, and migrations often need XML on one side and JSON on the other. A converter turns a JSON export into an XML file that an old import tool can read, without a spreadsheet in between and without retyping anything.
Students are a fourth group. Comparing the same data in JSON and XML side by side is the fastest way to understand both formats. The converter shows the mapping in action: objects to elements, arrays to repeats, nulls to empty tags — and the differences between the two formats become obvious.
JSON to XML vs XML to JSON
The two directions are mirror images, but they are not symmetric. Converting JSON to XML is the easy direction: JSON has fewer types, and every JSON value has an obvious XML home. The reverse direction has to make choices — about attributes, about repeated elements, about text — that JSON never had to make.
That is why the two tools sit side by side. Use this converter when the destination needs XML: a legacy API, an old config format, a feed. Use the reverse converter when the destination needs JSON: a modern API, a JavaScript app, a data pipeline. The data is the same; only the audience changes.
Checking the input first is good practice in both directions. A JSON formatter prints your JSON neatly so you can read it before converting, and a text formatter cleans up plain text that came out of a document. Read the data, then convert it — the converter is the second step, not the first.
Moving the result safely is another job. A base64 encoder decoder turns the XML into a single safe string for transport inside a URL or a header, and a data storage converter tells you how big the result is. Convert first, then move it — in that order.
Common conversion mistakes
The most common mistake is expecting XML attributes. JSON has no attributes — only keys and values — so this converter writes everything as elements. If the system you are feeding expects <book id="1"> instead of <book><id>1</id></book>, you need a mapping step, not a straight conversion. Know what the destination expects before you convert.
Second: keys that are not valid XML names. A key like "first name" becomes <first_name>, and a key like "2nd" becomes <_2nd>. If the destination system expects the original spelling, the conversion will not match. Rename the keys in the JSON first, or accept the cleaned-up tags.
Third: forgetting that numbers become text. In XML, 36 is the text "36", not a number. The value survives the trip, but the type does not — XML has no number type. If the destination needs to know that a value is a number, that knowledge has to live in the destination's schema, not in the XML itself.
Fourth: converting broken JSON and expecting the tool to fix it. A converter cannot repair a missing quote or a trailing comma. If the tool reports invalid JSON, fix the error it points to and convert again. The error message is the help, not the obstacle.
How to use this JSON to XML converter
Using this converter is simple. Paste your JSON into the box, or type it directly. The XML appears instantly in the box below, with the element count and nesting depth shown above it. There is no button to press and no form to submit.
To use the result, select the text in the output box and copy it. To convert another block, select all, delete, and paste the new one — the counts reset instantly. If the JSON is invalid, the output box shows the error message instead; read it, fix the spot it points to, and paste again.
Everything runs in your browser. No sign-up, no account, no data sent anywhere — your JSON never leaves your device. It works offline once the page has loaded, so you can use it on a plane, in a server room with no signal, or anywhere else you move data between systems.
Try it with something real before you need it: paste a JSON response from an API you use and read the XML it becomes. Once you have used it twice, the mapping — objects to elements, arrays to repeats — becomes second nature, and the format gap stops being a chore.