JSON to XML
Paste or drop your data here, or open a file.
New to Bracely?
Everything stays in your browser.
Output appears here
Paste or open your data in the input box. It never leaves your browser.
JSON to XML Converter
Convert JSON into well-formed XML with a root element you choose, or switch direction to turn XML into JSON with numbers and booleans detected.
Example: JSON with attributes, text and a list
Keys starting with @ become attributes and #text becomes the element's text, the same convention XML to JSON uses, so the two directions round-trip. The array becomes repeated item elements, and the < > & in the note are escaped:
Input
{
"order": {
"@id": "ORD-20419",
"customer": "Ananya Rao",
"item": [
{
"@sku": "KB-01",
"#text": "Keyboard"
},
{
"@sku": "MS-02",
"#text": "Mouse"
}
],
"note": "Leave at <gate> & ring"
}
}Output
<?xml version="1.0" encoding="UTF-8"?>
<order id="ORD-20419">
<customer>Ananya Rao</customer>
<item sku="KB-01">Keyboard</item>
<item sku="MS-02">Mouse</item>
<note>Leave at <gate> & ring</note>
</order>
How do I use the JSON to XML?
- Paste JSON, or choose XML → JSON and paste XML.
- Set the root element name if you need a particular one.
- Copy the result or save it to a file.
What does the JSON to XML do?
- Both directions: JSON to XML and XML to JSON
- Choose the root element
- Detect numbers and booleans, or keep every value as text
- Opens .xml files directly
When to use the JSON to XML
Some systems only take XML: SOAP endpoints, older enterprise and banking integrations, payment gateways and many government APIs. Converting JSON to XML gives you a well-formed document to send or to test with, with a root element you choose.
Objects become elements and arrays become repeated elements named after their key. Keys starting with @ become attributes and #text becomes an element's text, the same convention XML to JSON uses, so a document survives the round trip. Text is escaped (< > &), keys that aren't valid XML names are fixed (first name becomes first_name, 1st becomes _1st), and a top-level array becomes item elements inside the root.
Frequently asked questions
- How do I make an attribute?
- Start the key with @: {"order": {"@id": "ORD-1"}} gives <order id="ORD-1"/>. Use #text for the element's own text next to attributes.
- Why was my key renamed?
- XML names can't contain spaces or start with a digit, so first name becomes first_name and 1st becomes _1st. Rename the keys in the JSON if the receiver expects other names.
- How are arrays converted to XML?
- Each array item becomes a repeated element with the array's key as its name.
- Can I convert XML to JSON?
- Yes. Change Direction to XML → JSON.
- Is my data uploaded?
- No. The conversion happens on your device.
More JSON tools
Bracely has 108 JSON tools in one page. Related ones:
- JSON to Excel
- YAML to JSON
- CSV to JSON
- XML to JSON
- JSON to TOML
- TOML to JSON
- JSON Lines / NDJSON
- JSON5 / JSONC to JSON
- JSON to SQL
- JSON to Markdown table
- JSON to HTML table
- JSON to query string
- JSON to plain text
- cURL to JSON
- JSON to C#
- JSON to Python
- List tools
- Remove duplicates
- JSON Formatter
- JSON Validator
- JSON Viewer
- JSON Repair
- JSON Diff
- jq Playground
Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram