ToolStudio.es
In your browser1 Free Trial

Convert XML to JSON

Turn XML, RSS feeds or SOAP responses into JSON that's easy to use from JavaScript, Python or any API.

Free try: process 1 document (pasted or 1 file) and change the options as often as you like. Errors do not use up your try.
Input · XML

Everything runs in your browser: your data is never sent to a server.

Result · JSON
Indentation

Attributes are written as “@name” and text next to other nodes as “#text”. Repeated elements become a list.

From XML to JSON

XML is still everywhere in RSS feeds, SOAP services, config files and exports from business software, but working with it in code is more cumbersome than with JSON. This tool reads the XML and turns it into a JSON object.

Each element becomes a key; attributes are written as “@name”; repeated elements are grouped into an array; and when an element has text as well as attributes or children, the text goes in “#text”. Empty elements become null.

By default every value stays a string, just as in the XML. Turn on “Detect numbers and true/false” and numeric and boolean values come out with their type. If the XML isn't well-formed, you see the error and its line.

How to convert XML to JSON

  1. Paste the XML or open an .xml, .rss or .svg file.
  2. Choose whether to keep the root element and detect numbers.
  3. Click “Convert to JSON”.
  4. Copy the result or download it as a .json file.

When to use it

  • Reading an RSS or Atom feed from a JavaScript app.
  • Working with the response from a SOAP service.
  • Migrating config or data exported as XML to a system that uses JSON.
  • Inspecting a large XML file in a more compact form.

Frequently Asked Questions

How are attributes represented?

As keys with “@” in front: <product id="7"> becomes {"product": {"@id": "7"}}. It's the most widely used convention and the one our JSON to XML converter uses too.

Why is an element sometimes an object and sometimes an array?

If an element appears only once, it's a single value; if it repeats, it's an array. That's the usual way to convert XML, so keep it in mind if a feed can contain one item or several.

Are namespaces and CDATA preserved?

CDATA content is converted to plain text. Namespace prefixes are kept in the key name (for example “dc:creator”).

Is my data sent to a server?

No. Everything is processed in your browser with JavaScript. The text you paste and the files you open never leave your device, so you can safely work with internal or customer data.

Is it free?

Yes. You can try the tool for free on one document (pasted or a single file) and change the options as often as you like; attempts that end in an error don't use up your free try. For unlimited use and processing several files at once, ToolStudio Pro costs €1.99 a month and includes every tool.

Related tools

Development

JSON to XML Converter

Convert JSON to XML: each key becomes an element, lists repeat the element and “@name” keys become attributes. Special characters are escaped and invalid names fixed.

JSONXML
Try this tool
Development

JSON Formatter

Paste minified or messy JSON and get it back indented with 2 or 4 spaces or tabs, with sorted keys if you want. Any error is shown with its line and column.

JSON
Try this tool
Development

YAML to JSON Converter

Convert YAML to JSON, including anchors, aliases and several documents separated by “---”. If the YAML has an error, it shows the line and column.

YAMLJSON
Try this tool
Development

JSON to CSV Converter

Convert JSON to CSV with one column per key, flatten nested objects (“address.city”) and choose comma or semicolon as the delimiter. The CSV opens in Excel with accents intact.

JSONCSVExcel
Try this tool
Featured on TinyShelf