Data and JSON tools Free · No sign-up · No upload

Convert XML to JSON

Turn XML into JSON that is easy to use in code. Attributes are kept as keys with a prefix, and malformed XML is reported with its line and column. Nothing leaves your browser.

  • Unlimited runs
  • No data leaves the tab
  • Attributes kept
  • Checks well-formedness
Your data
  • Runs on your device. Files are never uploaded.
  • Free and unlimited. No sign-up, no watermark.
Private: processed in your browserNo upload waitIN: XML → OUT: JSON
How was XML to JSON?
How it works

XML to JSON in three steps

No account, no email, no waiting for an upload.

  1. STEP 01

    Paste or open your XML

    Use an .xml, .svg, .rss, .atom, .kml, .gpx, .plist or .txt file, or paste into the box.

  2. STEP 02

    Set the options

    Choose the attribute prefix (or none), whether numbers and true/false become real values, and the indent.

  3. STEP 03

    Copy or download the JSON

    If the XML is not well-formed, you get the line, column and reason instead.

What you get

What XML to JSON does, and what it doesn't

We'd rather tell you up front than surprise you after the download.

What you get

  • Attributes preservedAn attribute id="7" becomes a key such as @id. Choose @, @_, _ or - as the prefix, or drop attributes.
  • Text next to attributesWhen an element has both text and attributes, the text is stored under the #text key.
  • Typed values on requestTurn on 'Read numbers and true/false as values' to get real numbers and booleans instead of strings.
  • Repeated elements as listsSibling elements with the same name are collected into a JSON array.
  • Syntax check firstThe XML is validated before conversion, with a precise position for any error.

Good to know

  • Single versus repeated elementsAn element that appears once becomes an object, and one that appears twice becomes a list. Code reading the JSON should handle both.
  • Comments and declarations are droppedThe XML declaration, processing instructions and comments do not appear in the JSON.
  • NamespacesPrefixes such as ns:tag are kept as part of the name, not resolved.
Private by design

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 device→Their server→Your device

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

Your device does all the work

The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.

Made for real work

When people use XML to JSON

Consume an XML API in JavaScript

Convert a sample response to see which keys your code should read.

Read RSS and Atom feeds

Get feed items as plain objects.

Move data to a JSON-based store

Convert exports from an older system.

Inspect config and plist files

Look at structure without XML noise.

Compare

Mediaextractr vs typical upload tools

MediaextractrPrivateTypical upload tools
Your file is uploadedNeverYes
Sign-up neededNoOften, after a few files
Daily file limitNoneOften 1–2 free files
WatermarkNeverSometimes
Wait for upload & downloadNoYes
Speed on very large filesDepends on your deviceDepends on their servers

How the XML is mapped

Each element becomes a key. Child elements become nested objects. When the same child name repeats, they are gathered into a list. Plain text becomes a string value, or a number if you ask for typed values.

Attributes are written as keys with a prefix, so they are easy to tell apart from child elements: @id sits next to title.

Choosing options: XML to JSON

The right prefix depends on what reads the JSON next:

  • @ is the common choice and reads well.
  • _ or - avoids special characters in some tools.
  • No attributes gives a smaller JSON if you do not need them.
  • Need a table instead of nested JSON? Use XML to CSV.
  • Go back with JSON to XML, or inspect the XML first with the XML formatter.

Handling single and repeated elements

XML does not say whether an element is a list, so the JSON depends on what the document happens to contain. A feed with one item gives an object, and a feed with two gives an array. If your code reads the result, normalize it: wrap a lone object in an array before looping.

FAQ

Questions, answered

How do I convert XML to JSON?

Paste the XML, choose your options and copy the JSON.

What happens to XML attributes?

They become keys with a prefix, @ by default. You can choose another prefix or leave them out.

Does converting my XML export upload it?

No. The XML is parsed in this browser tab, so feeds and exports with private records are not sent anywhere.

Why is one element an object and another a list?

Elements that appear once become objects, repeated ones become arrays. That mirrors how the XML is written.

Can it read numbers as numbers?

Yes. Turn on 'Read numbers and true/false as values'.

Will it convert XML on iPhone and Android?

Yes, in the mobile versions of Safari and Chrome. Paste the XML or pick a file, then copy or save the JSON.