Convert JSON to XML
Turn JSON into indented, well-formed XML. Keys that start with @ become attributes, and invalid element names are fixed for you. Done in your browser, so nothing is uploaded.
- No sign-up
- Processed locally
- Attributes with @ keys
- Valid element names
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
JSON to XML in three steps
No account, no email, no waiting for an upload.
- STEP 01
Paste or open your JSON
Objects and lists both work.
- STEP 02
Set the XML options
Choose the attribute prefix, the root element, the name for list items, and the indent.
- STEP 03
Copy or download the XML
The file starts with an XML declaration and is indented.
What JSON to XML does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- AttributesKeys beginning with @ (or another prefix you pick) are written as attributes. The text content of an element can use the #text key.
- Root elementIf your data has one top-level key, it becomes the root. Otherwise the tool wraps the data in a root you name.
- List itemsLists are written as repeated elements. Lists inside lists use an item name you control.
- Safe element namesSpaces and invalid characters in keys are replaced, and a leading digit gets an underscore. You are told how many names were changed.
- Escaping done for youCharacters like & and < are escaped, and characters XML cannot hold are removed.
Good to know
- JSON has no attributesThe convention of @ keys is a choice, not a standard. Make sure the receiving system expects the same convention.
- Null valuesA null becomes an empty element, so null and an empty string look the same in XML.
- No schemaThe output is well-formed but not checked against an XSD. Check syntax with the XML validator.
Your data never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use JSON to XML
Call a legacy SOAP or XML API
Convert a JSON test payload into the XML an older service expects.
Exchange data with partners
Produce XML feeds from a JSON source.
Build RSS-like or sitemap-style files
Prepare content in JSON and output XML.
Migrate formats
Move configuration from JSON to an XML-based tool.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
How JSON maps to XML
Object keys become element names, and values become element content. A list becomes the same element repeated. So {"book": [{"title": "A"}, {"title": "B"}]} gives two book elements.
To write an attribute, start the key with @. {"book": {"@id": "7", "title": "A"}} produces <book id="7"><title>A</title></book>.
Tips for a clean result
A few settings decide how the output looks:
- If your data is a list at the top, set the Root element and List item element names.
- Pick another attribute prefix if your keys already start with @.
- Use 4 spaces or tabs if your reviewers prefer them.
- Tidy or shrink the result with the XML formatter or XML minifier.
- Go back with XML to JSON.
XML conventions to agree on
JSON has no standard way to express attributes, namespaces or mixed text, so the mapping is a convention. Agree with whoever consumes the XML on the attribute prefix, the root name and how lists are named. For a SOAP-style service, you may need to add namespace declarations to the root element after converting.
Questions, answered
How do I convert JSON to XML?
Paste your JSON, set the root and attribute options, and copy the XML.
How do I create XML attributes?
Start a key with @, for example @id, and it is written as an attribute.
Is my JSON payload transmitted when converted to XML?
No. The XML is generated by script in your browser, so test payloads with real data are not uploaded.
What happens to keys with spaces?
They are changed into valid element names, for example first name becomes first_name.
How are arrays written?
As repeated elements with the same name.
Can I convert JSON to XML on a phone or tablet?
Yes. Paste JSON in a current phone or tablet browser and copy the XML. The declaration and indent are the same as on a desktop.