JSON to XML Converter Online
- This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.
JSON
Tab indents · Shift+Tab outdents · Esc then Tab moves on
XML
Your XML shows up here
Paste or type on the left, upload a file, or drop one onto the input.
JSON & data
- JSON to TypeScriptTypeScript interfaces from JSON
- JSON to ZodZod schemas from JSON samples
- YAML to JSONConvert YAML configs to JSON
- JSON to YAMLConvert JSON to clean YAML
- JSON to CSV ConverterTurn a JSON array into a spreadsheet
- CSV to JSON ConverterTurn CSV rows into JSON objects
- XML to JSON ConverterTurn XML into JSON, with attributes
About this tool
Paste JSON and get XML as you type. Objects become nested elements, arrays become repeated elements with the same name, and numbers, booleans and null are written as text (a null becomes an empty element). Special characters such as <, > and & are escaped, so the output is always well-formed.
XML has two things JSON does not: attributes and a single root. Keys that start with @ (or _, if you pick that prefix) are written as attributes, and a #text key becomes the element’s text, so {"price": {"@currency": "INR", "#text": "499"}} turns into <price currency="INR">499</price>. If your JSON has exactly one top-level key, that key becomes the root element. If it has several, or is an array, they are wrapped in the root element name you choose, which defaults to root.
JSON keys can contain spaces or start with a digit, which are not allowed in XML tag names, so the converter replaces invalid characters with _ and adds a leading _ where needed. You can choose 2 or 4 space indentation or a minified single line, and turn the <?xml …?> declaration on or off. The result can be copied or downloaded as a .xml file.
Everything runs in your browser. For the opposite direction, use the XML to JSON converter, which follows the same attribute and text conventions so a round trip gives you back what you started with.
Frequently asked questions
How do I write an attribute in the JSON?
Prefix the key with @, for example {"book": {"@id": "7", "title": "Dune"}} gives <book id="7"><title>Dune</title></book>. You can switch the prefix to an underscore in the options.
How are arrays converted?
Each item becomes a repeated element named after the array’s key. {"item": ["a", "b"]} becomes <item>a</item><item>b</item>. A top-level array is wrapped in the root element and its items are called item.
What happens to keys that are not valid XML names?
Characters that are not allowed are replaced with an underscore, and a name that starts with a digit or symbol gets a leading underscore. “first name” becomes first_name and “9lives” becomes _9lives.
Why is there a root element I did not write?
XML documents must have exactly one root. If your JSON has several top-level keys or is an array, the converter wraps it in a root element. Change its name in the options.
Are numbers and booleans kept?
They are written as text, because XML has no number or boolean type. null becomes an empty element. When you convert back to JSON, all values come back as strings.
Is my JSON uploaded anywhere?
No. The conversion runs in your browser and nothing is sent to a server, so configuration files, API payloads and customer data stay on your device.