Skip to main content
Free File Converter

XML to JSON converter

Turn an XML document into JSON, keeping or dropping attributes.

Processed in your browser. This file is converted on your device and is never uploaded.

Converter

Input

.xml up to 25 MB. You can also drag a file here.

Options
JSON has no attributes, so they need a naming convention.
Turn off for a smaller single-line file.

No file selected.

About this tool

XML arrives from legacy APIs, RSS feeds, sitemaps, and exported office documents, and most modern code would rather work with JSON. This tool parses an XML document and writes the equivalent JSON.

XML attributes have no direct JSON counterpart, so you decide up front whether to keep them under prefixed keys or drop them entirely.

Supported formats and limits

Input
.xml
Output
.json (application/json)
Output name
The original name with the new extension, for example data.xml becomes data.json.
File size limit
25 MB
Processing
In your browser. The file is not uploaded.

How to use it

  1. Choose an .xml file, or switch to Paste text and paste the document directly.
  2. Decide how attributes should be handled.
  3. Choose whether to indent the JSON.
  4. Select Convert, then download the .json file.

Limitations

  • The conversion is not perfectly reversible. XML carries distinctions JSON cannot express, including attribute versus element, node ordering across different element names, and mixed content.
  • A repeated element becomes an array, but an element that appears exactly once becomes a single value. Code reading the result has to handle both shapes.
  • Mixed content, where text and child elements sit side by side in the same element, is not represented faithfully.
  • Comments, processing instructions, and DTDs are discarded.
  • Namespace prefixes are kept as part of the key name; they are not resolved to their URIs.
  • Values stay as strings, so numeric-looking text is not converted to numbers.

Frequently asked questions

Is my file uploaded?
No. The conversion runs entirely in your browser. The file never leaves your device and no request carrying its contents is made.
What does the @ prefix mean in the output?
It marks a value that came from an XML attribute rather than a child element, which keeps the two from colliding when they share a name.
Why is one item an object and another an array?
XML gives no hint that an element is repeatable, so a single occurrence looks like a single value. If your consumer needs an array, normalize it after conversion.
What happens with invalid XML?
The document is validated before parsing, and an unclosed or mismatched tag stops the conversion with the line and column where the problem was found.