Skip to content
freeonlinefileconvert

XML to JSON

Turn an XML file, feed or export into clean, indented JSON that any app or script can read.

or drop them here · up to 50 MB per file, free

Bigger files? Pro converts files up to 500 MB

This is bigger than the free version

You can still do it: convert it now and pay €1.99 only if you want to download the result.

Free covers files up to 50 MB and up to 20 files at a time.

Need it the other way round?JSON to XML

Free · No sign-up · No watermark · Your files never leave your device

XML to JSON in 3 steps

  1. Select your XML file, or drop it on the box.
  2. Click Convert to JSON.
  3. Download the JSON file, ready to use in your code or app.

How the XML becomes JSON

XML and JSON describe the same kind of tree, but they do not map one to one, so every converter has to make choices. Here each element becomes a key, attributes become keys that start with @, and text that sits next to attributes or child elements goes into a #text key. When an element appears several times in a row, like the items of an RSS feed, it becomes a list.

Numbers and true or false become real JSON values, while codes with leading zeros, such as postcodes or phone numbers, stay as text so no digit is lost. Comments and processing instructions are left out. If the XML is broken, you get the parser message with the line where it fails instead of a half-converted file.

Frequently asked questions

How do I convert XML to JSON?

Select your XML file here and click Convert to JSON. The browser parses the file and writes indented JSON you can download straight away. It works with exports, sitemaps, RSS feeds, SOAP responses and configuration files, on any device.

What happens to XML attributes?

Attributes are kept as keys that start with @, so <book id="7"> becomes "book": {"@id": 7}. Text inside an element that also has attributes is stored under "#text". This is the most common convention, and our JSON to XML tool reads it back the same way.

Why is one element a list and another a single object?

An element that appears more than once inside the same parent becomes a list; an element that appears once stays a single value. If your code always expects a list, check for both cases, because a feed with only one item will produce a single object.

My XML file gives an error. What is wrong?

The file is not well-formed XML: often an unescaped & in text, a missing closing tag or two root elements. The error shows the line the parser stopped at. Fix it in a text editor and try again, or open the file in a browser to see the same message.

Is my file uploaded to a server?

No. The XML is read by your own browser and converted on your device, so internal exports, invoices or customer data never leave your computer. Once the page has loaded, the converter keeps working even without an internet connection.

Related tools

You are one of the first

FreeOnlineFileConvert has just launched. Create a free account now and join our Family & Friends list: the full Pro plan, free for life.

Pro0 €6,99 €
Join for free