JSON to XML Converter
Paste a JSON document and this converter returns well-formed XML with each object key as an element, arrays expanded into repeated tags, and the five XML special characters escaped for you. You can rename the root element and switch between two spaces, four spaces, a tab or compact output. The whole conversion happens in your browser, so nothing is uploaded.
How to convert JSON to XML
- Paste or type your JSON into the JSON input box, or press Load sample.
- Set the Root element name that will wrap the whole document (root by default).
- Choose an Indent of 2 spaces, 4 spaces, a tab or Compact for no line breaks.
- Read the generated XML in the output box, with the declaration line on top.
- Copy the XML or download it as data.xml for use elsewhere.
Examples
Object keys become elements
{"name":"Ada","age":36}<?xml version="1.0" encoding="UTF-8"?> <root> <name>Ada</name> <age>36</age> </root>
An array becomes repeated tags
{"name":"Ada","skills":["Math","Engineering"]}<?xml version="1.0" encoding="UTF-8"?> <root> <name>Ada</name> <skills>Math</skills> <skills>Engineering</skills> </root>
A top-level array uses item elements
[1,2,3]
<?xml version="1.0" encoding="UTF-8"?> <root> <item>1</item> <item>2</item> <item>3</item> </root>
Frequently asked questions
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser using client-side JavaScript, so your JSON never leaves your device and nothing is logged on a server.
How are JSON arrays turned into XML?
Each array item becomes a repeated element that reuses the key it sat under, since XML has no native array type. So a skills array of two strings becomes two sibling <skills> elements rather than one wrapper element.
What happens to a top-level array with no key?
A JSON document whose root is an array has no key to name its items, so each element is wrapped in a generic <item> tag inside the root element. This keeps the output valid even when the outermost value is a list.
Are special characters escaped?
Yes. The characters &, <, > and the double quote are replaced with their XML entities (&, <, > and "), so text containing angle brackets or ampersands does not break the markup.
What happens to keys that are not valid XML names?
Spaces and other illegal characters in a key become underscores, and a key that begins with a digit, a dot or a hyphen is prefixed with an underscore, because XML element names cannot start with those.
How are null values represented?
A JSON null becomes an empty element such as <note></note>. The tag is kept so the structure stays intact, but it carries no text content.
Are values written as attributes or as text?
Everything is written as element text content, never as XML attributes. Numbers and booleans are converted to their string form, so true becomes the text true and 36 becomes the text 36 inside their tags.
Can I change the root element or remove indentation?
Yes. Type any name into the Root element field, and pick 2 spaces, 4 spaces, a tab or Compact from the Indent menu. Compact output drops all line breaks and produces a single dense line.
Does it convert XML back into JSON?
No, this tool only goes one direction, from JSON to XML. For the reverse, or for related formats, try a dedicated XML-to-JSON tool or the JSON to CSV and JSON to YAML converters.
Learn more
- How JSON structures map onto XML
The rules this converter follows when it turns objects, arrays, primitives and awkward keys into valid, readable XML markup.
Related tools
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
JSON to YAML
Convert JSON to YAML online. Paste JSON and get clean, readable YAML with 2-space indentation and no line wrapping. Fast, free and runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.