Blog
Image Tools
Crop Image
Resize Image
Rotate & Flip
Compress Image
Photo Filters
Meme Generator
GIF Maker
Collage Maker
Watermark Image
Blur Image
Convert
JPG to PNG
PNG to JPG
HEIC to JPG
DNG to JPG
Image Converter
PDF to JPG
JPG to PDF
Merge PDF
Compress PDF
MP4 to MP3
Video to GIF
MOV to MP4
MP3 Converter
Video & Audio
Trim Video
Crop Video
Remove Audio
Text to Speech
Audio Cutter
MP3 Compressor
Design & Editor
Resume Builder
Design Editor
Add Text to Photo
Social Media Resizer
QR Code Generator
Signature Generator
More Tools
Word Counter
Password Generator
Random Picker
Dice Roller
Spinner Wheel
Favicon Generator
Barcode Generator
Browse All Tools

XML to JSON Converter

Turn XML files, feeds and messages into JSON that is easy to read and use in code. Attributes are kept as @ keys, repeated elements are grouped into arrays, and broken XML gets a clear message instead of a silent failure.

100% Free
No Sign-up
Attributes Kept
Arrays Grouped
Private · Nothing Saved Online
XML to JSON
Your Text
Input Characters—
Output Characters—
Lines In → Out—
Input Words—
Type or paste in the input box, or open a file. The result updates as you type.
JSON to XML
XMLType, paste or drop a file
JSON
Input—
Result—
Status—
Settings forYour data
Options
File Name

How to Convert XML to JSON

Quick answer: paste your XML or open an .xml file; the JSON appears below. Download it or copy it.

  1. 1

    Add your XML

    Paste it or open an .xml file.

  2. 2

    Choose options

    Attributes, types and arrays.

  3. 3

    Check the JSON

    Errors are explained clearly.

  4. 4

    Download .json

    Or copy it.

What You Get

Attributes
Kept as @ keys
Arrays
Repeated elements grouped
Typed Values
Optional
Clear Errors
Broken XML explained
Private
Nothing is uploaded
Any Device
Phone or computer

Why Convert XML to JSON?

XML is still common in feeds, exports, office files, configuration and older business systems, but most modern tools and code prefer JSON. Converting XML to JSON makes the data shorter, easier to read and simple to use in apps, scripts, spreadsheets and no-code tools.

How XML Maps to JSON

Each element becomes a key with its child elements nested inside. Elements that appear more than once under the same parent, such as several <book> elements, are grouped into an array. Attributes become keys starting with @, so id="b1" becomes "@id": "b1". When an element has both attributes and text, the text goes into a "#text" key. Empty elements become empty strings, and comments and processing instructions are skipped.

Options Explained

Typed values turns text such as 12.5 or true into numbers and true or false. Always use arrays wraps every child element in an array, even if it appears once, which makes the structure predictable for code that loops over results. Keep the root element name wraps the result in an object named after the root; turn it off to start directly with the root's contents.

Example

The sample catalogue becomes { "catalog": { "@version": "2", "book": [ { "@id": "b1", "title": "The Silent Sea", "price": "12.5" }, … ] } }. With typed values on, the prices become numbers. To go back, use JSON to XML.

Who Converts XML to JSON?

Developers working with feeds and older services, analysts extracting data from exports, e-commerce teams reading supplier catalogues, content managers moving articles between systems and students exploring data formats. Converting in the browser keeps sensitive files private.

When the XML Is Broken

XML must be well-formed: every tag closed, tags properly nested and special characters like & written as &amp;. If something is wrong, the converter shows the browser's description of the problem, often with a line number, so you can fix it. Common causes are a missing closing tag, an unescaped ampersand or text pasted before the first tag.

Good to Know

Namespace prefixes such as media:title are kept in the key names. Whitespace between elements is ignored, but text inside elements is kept as it is, apart from leading and trailing spaces. To tidy the resulting JSON, open it in the JSON Formatter, and to turn it into a spreadsheet, use JSON to CSV.

Real-World Scenarios

A partner sends a daily XML feed of stock levels and you want to load it into a spreadsheet or a no-code automation. Convert it here to JSON, then use JSON to CSV to get a table. Developers debugging an older service paste a response and read it as JSON, which is far shorter. Bloggers moving to a new platform convert the XML export of their old site to inspect posts and categories before importing them. Because the file never leaves the browser, it is safe to convert internal exports that contain customer or pricing details.

Private, Free and Instant

The converter is free and works with files up to 5 MB. There is no sign-up, no row limit beyond the 5 MB file size and nothing to install. The conversion runs in your browser, so customer lists, exports, settings files and other private data are never uploaded or stored. You can open a file from your device, paste data straight from another program, and download the result with the right file extension. It works on Windows, Mac, Linux, Chromebooks, iPhone and Android.

XML to JSON: Mapping Elements, Attributes and Text

XML and JSON describe nested data, but they treat it differently. XML has attributes and mixed text, JSON has arrays and plain values.

Mapping rules

Elements become keys, attributes are stored with a marker such as @ or in a special object, repeated elements become arrays and text content is stored under a text key. Namespaces and comments may be dropped.

Pitfall

A single child element may become an object, while two become an array, so code that reads the result must handle both. For the reverse, use JSON to XML.

Frequently Asked Questions

Questions about XML to JSON

How do I convert XML to JSON?

Paste your XML or open an .xml file. The JSON appears straight away.

What happens to attributes?

They become keys starting with @, such as @id.

How are repeated elements handled?

They are grouped into an array.

Why do I get an error?

The XML is not well-formed. The message explains what is wrong and where.

How large can my file be?

Up to 5 MB of text, which is tens of thousands of rows for most data.

Is my data uploaded?

No. The conversion happens in your browser on your own device. Your data is never sent or stored.