Free Developer Tool

XML to JSON Converter: Turn XML into Clean JSON in Seconds

Paste your XML and convert it to JSON with one click. Tags become keys, nested elements become objects, and the output is ready for your code.

XML to JSON Nested elements Readable output Built-in sample API ready Works on mobile No signup

Convert XML to JSON Without Writing a Parser

XML still runs a big part of the web: RSS feeds, SOAP APIs, sitemaps, config files and old enterprise exports. Most modern apps, though, expect JSON. This XML to JSON converter bridges that gap. Paste the XML, hit Convert and you get JSON you can drop into JavaScript, Python or any REST API, with no scripts or libraries to set up.

Read more
XML document rewritten as JSON with elements turned into keys

What Is XML to JSON Conversion?

XML to JSON conversion rewrites an XML document as the same data in JSON format. Each element becomes a key, its text becomes the value, and child elements turn into nested objects. Repeated tags, like several <item> elements in a row, become an array.

Lightweight JSON payload compared with a larger XML payload

Why Change XML to JSON?

JSON is lighter, easier to read and native to JavaScript. When you change XML to JSON, payloads get smaller, front-end code gets simpler and you work with plain objects instead of DOM queries and XPath.

Online XML to JSON converter running in a browser on desktop and phone

An Online XML to JSON Converter That Just Works

There's nothing to install and no account to create. This XML to JSON converter online runs in any modern browser on Windows, Mac, Linux, Android or iPhone, so you can convert an XML to JSON from your desk or from your phone.

SOAP response parsed to JSON for API testing

Parse XML to JSON Online for API Testing

Testing a SOAP service or an XML feed? Parse XML to JSON online to see the structure clearly, find the fields you actually need and plan your data mapping before you write a single line of code.

JSON data ready for React, Node.js and MongoDB

Transform XML to JSON for Modern Apps

React, Node.js, MongoDB and most no-code platforms speak JSON. Transform XML to JSON online once and the data is ready for your database, your front end or your automation workflow.

Parent-child XML hierarchy preserved as nested JSON objects

Keep the Structure You Started With

Good XML to JSON conversion keeps the hierarchy intact. Parent-child relationships stay nested, so a <customer> with an <address> inside it still reads as one customer object with an address object inside.

How to Convert XML to JSON

1

Paste your XML

Copy the XML from your file, feed or API response and paste it into the input box. Click Sample if you'd like to see how it works first.
2

Click Convert

The XML to JSON converter reads every element and returns structured JSON in the output box.
3

Check the output

Look over the keys and arrays. If the XML has a syntax error, such as a missing closing tag, fix it and convert again.
4

Copy and use it

Copy the JSON into your code, API client or app. Click Reset to clear both boxes and start a new conversion.

XML to JSON Converter FAQs

Common questions about converting XML to JSON.

How do I convert XML to JSON online?

Paste your XML into the box above and click Convert. The tool returns JSON right away. It's the quickest way to convert XML to JSON online when you don't want to set up a script or install software.

What does an XML to JSON conversion look like?

Here's a simple example. This XML: <user> <name>Sarah</name> <city>Austin</city> </user> becomes this JSON: { "user": { "name": "Sarah", "city": "Austin" } } The root tag becomes the outer key and each child tag becomes a property.

How are repeated XML tags handled?

When the same tag appears more than once at the same level, such as several <book> elements inside <library>, they're grouped into a JSON array. That's the standard behavior whenever you convert from XML to JSON, and it keeps lists easy to loop over in code.

How do I convert XML to JSON in Python?

The easiest route for Python XML to JSON conversion is the xmltodict library: import xmltodict, json data = xmltodict.parse(xml_string) print(json.dumps(data, indent=2)) It handles nesting and attributes for you. For a one-off file, pasting it into this converter is faster than writing XML to JSON Python code.

How do I handle JavaScript XML to JSON conversion?

Most XML to JSON JavaScript code takes one of two routes. In the browser you can read XML with DOMParser, but you then have to walk the tree yourself. In Node.js, the fast-xml-parser package makes JS XML to JSON a two-line job: const { XMLParser } = require("fast-xml-parser"); const json = new XMLParser().parse(xmlString); console.log(JSON.stringify(json, null, 2));

Can I convert XML to JSON in n8n?

Yes. For n8n XML to JSON workflows, use the built-in XML node, which converts XML to JSON (and back) inside a workflow. Use this tool to preview the output first, so you know exactly which fields to map in the next node.

What's the difference between XML and JSON?

XML wraps data in opening and closing tags and supports attributes, namespaces and schemas. JSON uses key-value pairs, arrays and a small set of data types: strings, numbers, booleans and null. JSON is shorter and maps directly to objects in most programming languages, which is why it became the default format for web APIs.

What happens to XML attributes?

Attributes are usually turned into regular JSON keys, often with a prefix such as @ or _ so they don't clash with child elements of the same name. Different tools follow different conventions, so check the output before you map the fields in your code.

Is XML to JSON conversion lossless?

Mostly. Data, nesting and text values carry over. A few XML features, like comments, processing instructions and the order of mixed content, have no direct JSON equivalent, so they may be dropped. For typical API and config data, nothing important is lost.

Is this XML to JSON converter free?

Yes. It's free, needs no signup and works in any browser. Use it for feeds, API responses and config files as often as you need.

Make your JSON easy to read.

Run the output through our JSON Formatter to indent it neatly and catch errors before you ship.

Open JSON Formatter

Raheel Jakhura

CEO / Co-Founder

Our goal is to provide online free tools so you don't have to install any software for basic usages. We are trying to add more tools and make these tools free forever.

cookies image
We care about your data and would love to use cookies to improve your experience.