Skip to content

XML to JSON

Turn XML into JSON, attributes and repeated elements included.

  • 100% Free
  • No Sign Up
  • Nothing Uploaded

XML to JSON

Turn XML elements and attributes into JSON

XML input

JSON output

Output-

Processed on your device. Nothing is uploaded.

More converters

View all tools

Every format, one private converter.

No software. No uploads. No sign-up.

Browse all 96 tools
Files uploaded
0
Free tools
96
In your browser
100%

How to convert XML to JSON

Three steps, all in your browser.

  1. 1

    Paste or open your data

    Drop a file or paste rows straight into the input box.

  2. 2

    Check the options

    Delimiter, header row, indentation: the output updates live.

  3. 3

    Download

    Save the converted file, or copy the output.

XML to JSON: what to know

XML marks up data with nested elements and attributes. It's still common in feeds, office files, government data and older APIs, while most modern code expects JSON. This converter reads XML in your browser and writes the equivalent JSON.

Each element becomes a key, and nesting is kept. Attributes are kept as keys that start with @_, and when an element has attributes as well as text, the text goes under #text. Elements that repeat under the same parent become arrays, while a single element stays an object. CDATA sections become plain text, entities such as & are decoded and surrounding whitespace is trimmed. With typed values on, text that round-trips as a number or boolean, such as 42 or true, becomes a JSON number or boolean, while 007 or 9.50 stay strings. Comments and processing instructions are dropped.

The XML is checked before it's converted. If a tag is left open or closed in the wrong order, you get a short description of the problem with its line and column instead of a half-converted file.

Popular uses

  • Using RSS feeds, sitemaps or XML exports in JavaScript
  • Moving data from an XML-based API into a modern app
  • Reading the structure of an unfamiliar XML file
  • Preparing XML data for a JSON database

Tips for the best result

  • If an element sometimes appears once and sometimes several times, handle both an object and an array in your code.
  • Turn off typed values to keep every value as a string.
  • Convert to CSV instead when you want the first repeated element list as a table.

Read how JustYourConvert works and our privacy details. Keep your original files and check a converted file before you replace anything.

Frequently asked questions