Convert JSON to XML
Need XML for a SOAP service, a feed or an older system that only reads XML? Paste JSON and get indented, well-formed XML, with special characters escaped and invalid names fixed.
- Free
- Runs in your browser
- Well-formed output
- No sign-up
How It Works
Convert JSON in three steps.
Paste JSON
An object or an array, from an API, a file or a database.
Name the elements
Set the root element, the name for array items and the attribute prefix.
Copy or download
Copy the XML or save it as converted.xml.
How JSON becomes XML
Each JSON key becomes an element and each value its content. An array becomes the same element repeated, so {"tag": ["a", "b"]} gives <tag>a</tag><tag>b</tag>. Keys starting with @ become attributes and a "#text" key becomes the element's text, which is the same convention our XML to JSON converter uses, so the two work as a pair. A JSON object with exactly one key uses that key as the root element; anything else is wrapped in the root element you choose.
XML has no types, so numbers and true/false become plain text. Whoever reads the XML decides how to interpret them.
Attributes from @ keys
{"@id": 7} becomes id="7" on the element. Clear the prefix to turn every key into an element.
Valid element names
XML names cannot start with a digit or contain spaces, so "1st item" becomes _1st_item.
Escaped content
&, <, >, quotes and apostrophes are escaped so the output always parses.
null as empty element
A null value becomes a self-closing element such as <middleName/>.
Convert PDF Files and File Formats
Find the perfect online tool to combine PDF files, compress documents, and handle your daily workflow effortlessly.
PDF Tools
All your PDF needs in one place
- Merge PDF
- Organize PDF
- Split PDF
- Compress PDF
- Convert to Word
- Convert to Image
Image Tools
Edit and optimize your images
- Resize Image
- Compress Image
- Convert Format
- Crop Image
- Add Watermark
- Remove Background
Word Tools
Work with Word documents
- Convert to PDF
- Merge Documents
- Split Documents
- Compress File
- Edit Text
- Add Watermark
Excel Tools
Process Excel spreadsheets
- Convert to PDF
- Convert to CSV
- Merge Sheets
- Split Sheets
- Compress File
- Clean Data
Why Use This Converter
Clean XML from any JSON.
Pairs with XML to JSON
The same @ and #text convention in both directions.
Your element names
Choose the root and array item names to match a schema.
Readable or compact
Indent with 2 or 4 spaces, or put everything on one line.
Private
Converted in your browser.
Frequently Asked Questions
Questions people ask about the JSON to XML converter.
XML needs exactly one top-level element. When the JSON is not an object with a single key, everything is placed inside the root element. Change its name in Root element.
Prefix the key with @: {"item": {"@id": 3, "name": "Pen"}} gives <item id="3"><name>Pen</name></item>. Only simple values can be attributes.
Each item becomes an element named after Array item element (item by default), inside the root element.
It is optional for UTF-8 XML, but many systems expect it at the top. Untick it if you are inserting the XML into a larger document.
Related Text & Developer Tools
More small utilities that run in your browser.
XML to JSON
Convert XML to JSON with attributes kept.
JSON to YAML
Convert JSON to clean, readable YAML.
JSON Formatter
Format, validate and minify JSON.
JSON Flatten & Unflatten
Flatten nested JSON to dot keys or rebuild it.
HTML Entity Encode & Decode
Escape HTML special characters or turn entities back into text.