XML to JSON
Bring records out of older XML exports and into the tools your team uses today.
PrivateNo uploadsRuns in your browserAttributes are the extras inside a tag, like code="R01". They become "@_code".

For old records
Old data, ready for new systems.
The old files. Years of records wait in an old export.
BeforeDigging through old exports
With sdevOld records in today's format

Bring them over
Chethan moves them into the new system in minutes.

Back in use
The team can search old orders again.
How to convert XML and JSON
Paste or open
Paste XML into the Input pane, press Open to pick an .xml file, or drop it onto the pane. For the other direction, use the JSON to XML tab.
Set the options
Keep or drop attributes, turn number reading on or off, pick the indent and, for JSON to XML, the outer tag name and whether to add the header line.
Copy or download
Press Copy, or Ctrl+C with nothing selected, to copy the whole result. Download saves data.json or data.xml.
Good to know
- Text inside an element that also has attributes or children lands under the #text key.
- With Read numbers and true/false on, values that look like numbers become numbers. Turn it off to keep IDs with leading zeros as strings.
- The input is validated first, so an unclosed tag shows its line and column rather than a half-converted result.
- Files over 2 MB are read by the worker straight from disk. Only the first 1 MB of the result is drawn on screen; Copy and Download use the full output.
Where people use it
Use an old XML service
Turn an XML reply from an older system into JSON your new code can use.
Read a feed
Convert an RSS or sitemap file into JSON to pull out the links and titles.
Send XML to a partner
Some banks and government portals still want XML. Turn your JSON into it, with a root and a declaration.
Tidy the XML first
Pretty print a messy XML file and see any errors.
XML formatter and validatorNeed YAML instead?
Convert between YAML and JSON on the sister page.
YAML to JSON and JSON to YAML converter
Why this one
It keeps the parts of XML that are easy to lose, like attributes and namespaces, so you can go back to XML without surprises.
- Keeps attributes, namespaces and CDATA.
- Numbers and true or false come out as real values.
- Pretty or minified output.
- Runs in your browser, nothing is uploaded.
What you can change
- XML to JSON or JSON to XML
- Keep attributes
- Read numbers and true/false
- Root element name and XML header line
- Pretty or minified
People find this page by searching
- xml to json
- json to xml
- convert xml to json online
- xml to json converter
- json to xml converter
- soap xml to json
- xml file to json
- rss feed to json
Cite this tool
- APA
sdev.in. (n.d.). XML to JSON and JSON to XML converter [Web tool]. https://www.sdev.in/tools/xml-to-json
- MLA
"XML to JSON and JSON to XML converter." sdev.in, https://www.sdev.in/tools/xml-to-json.
- Chicago
sdev.in. "XML to JSON and JSON to XML converter." https://www.sdev.in/tools/xml-to-json.
- BibTeX
@misc{sdev-xml-to-json, title = {XML to JSON and JSON to XML converter}, author = {{sdev.in}}, howpublished = {\url{https://www.sdev.in/tools/xml-to-json}}, note = {Web tool} }
Questions people ask
How are attributes represented in JSON?
As keys that start with @_, next to the element's children, so <item code="7">Pen</item> becomes {"item": {"@_code": 7, "#text": "Pen"}}. Untick Keep attributes to drop them. The same prefix is read back when converting JSON to XML.
Why is a repeated element an array but a single one is not?
XML has no arrays, so the converter makes an array only when an element appears more than once under the same parent. A list with one item comes out as an object. Add a second item or handle both shapes in your code.
How do I get a root element when my JSON is an array?
Set the Outer tag. It wraps the output whenever the JSON is an array, a plain value, or an object with more than one top-level key, because XML needs exactly one root.
Are namespaces and CDATA handled?
Element names keep their prefix, such as soap:Body, and xmlns attributes appear as @_xmlns. CDATA sections are read as ordinary text. Comments and processing instructions are dropped.
Is my file uploaded?
No. Parsing and conversion run in a web worker inside your browser. Nothing is sent to a server.