JSON -> XML · Local tool
JSON to XML
Convert JSON to indented XML, with attributes and arrays handled.
Last updated
How do I convert JSON to XML in the browser?
Paste the JSON into filetity's JSON to XML converter and indented XML appears beside it, with nothing uploaded. A key prefixed with @ is written as an attribute and a key called #text becomes the element's own content, so one element can carry both, and those are the same rules the XML to JSON page reads, which makes the two directions inverses of each other. An array becomes the same element repeated, because that is how XML expresses a list. XML permits exactly one top-level element while JSON permits any value, so an object with a single key uses that key as the root and anything else is wrapped in a root element you can name. Keys that are not legal XML names, such as one containing a space or starting with a digit, are rewritten rather than rejected.
01 / Your device
the file stays here
02 / Browser memory
the work runs locally
03 / Back to you
saved on this device
When you would use this
Situations, not settings.
- A system that only accepts XML
- Payment gateways, government portals and older enterprise APIs still require it. Write the JSON you find readable and convert at the edge.
- Building a test fixture for an XML parser
- Editing JSON by hand is faster and less error prone than editing XML, and the @ prefix gives you attributes when the fixture needs them.
- Checking what your data looks like as XML
- Useful before committing to a schema: arrays become repeated elements and keys that are not legal XML names get rewritten, both of which are easier to see than to imagine.
How it works / no cloud
A conversion engine, not an upload form.
filetity parses the JSON with the browser's own parser and writes XML in the page, escaping ampersands and angle brackets in text and quotes in attributes, so the result actually parses. A key prefixed with @ is written as an attribute and #text as the element's own text, which is the same convention the XML to JSON page reads, so the two are inverses rather than two unrelated guesses.
- Offline ready
- Installable app
- No file limit queue
Straight answers
No accordion. Nothing hidden.
- Is it free?
- Yes, with no watermark and no page limit.
- Does it need an account?
- No. There is no account system.
- Is my file processed on my device?
- Yes. The file is read by your browser and never uploaded. There is no server to send it to.
- What formats are supported?
- JSON in, as an object, an array or a primitive. Indented XML out, with a declaration and a root element you can name.
- What are the limits?
- No size limit beyond what your browser will hold. A key that is not a legal XML element name is rewritten, and that is the one step in this direction that loses information.
- Does it work on mobile?
- Yes, on any modern mobile browser. Large files are limited by the memory the phone gives the browser.
- Does it work offline?
- Yes, once the page has loaded. The tool keeps working with no network connection.
- What happens to a key that is not a valid XML name?
- It is rewritten rather than refused. XML element names cannot contain spaces and cannot begin with a digit, so "first name" becomes first_name and "1st" becomes _1st. This is the only lossy step in this direction, and it is why the conversion back will not return your original key.
- How do I get an attribute instead of a child element?
- Prefix the key with @. So { "item": { "@sku": "PEN-01" } } writes <item sku="PEN-01"/> rather than a child element called sku. An element's own text goes under #text, which lets one element carry both attributes and content.
- What does an array become?
- The key repeated once per entry, which is how XML expresses a list: three entries under "item" become three <item> elements side by side rather than a wrapper containing them. A top-level array has no name to repeat, so its entries are called item inside the root element.
- Why does my XML need a root element when my JSON did not?
- Because XML allows exactly one top-level element and JSON allows any value at all. If your object has a single key, that key becomes the root and nothing is added. Anything else, an array or several keys, gets wrapped in a root element you can rename in the box above.
- Will the ampersands in my text break the output?
- No. Ampersands and angle brackets in text are escaped, and quotes are escaped inside attribute values as well. An unescaped ampersand is the most common way a generated XML document turns out to be unparseable, so the output here is checked by parsing it back.
Keep working locally
3 available · more coming