RunToolRunRunToolRun
Tools/Converters/XML to JSON

XML to JSON

Convert XML files to JSON format.

100% on device ยท 0 uploads
Drop files here
or click to select ยท .xml
01 ยท Unlimited
Use it as many times as you want โ€” completely free.
02 ยท Private
Your files never leave your device; everything runs in your browser.
03 ยท Fast
Processing happens locally and finishes in seconds.

How to Convert XML to JSON

1

Paste your XML

Drop an .xml file or paste raw XML โ€” feeds, configs, SOAP responses, exports.

2

Conversion runs locally

Elements, attributes and text nodes are mapped to a JSON structure in your browser.

3

Copy or download the JSON

Use the result in modern APIs, JavaScript apps and data pipelines.

The two formats do not describe the same shapes

XML has elements, attributes, text content and ordering. JSON has objects, arrays and values. There is no single correct mapping between them, which is why two converters can produce different, equally valid output from the same input.

Attributes are the clearest example. An XML element can carry both attributes and child elements, and JSON has no equivalent distinction โ€” so attributes end up prefixed, nested under a special key, or merged with the children, depending on the convention.

One item or a list

XML does not distinguish between a single element and a list with one entry. An order containing three items produces three repeated elements; an order containing one produces a single element that looks like a plain value.

Converted naively, the first becomes an array and the second becomes an object, so code reading the JSON breaks on single-item cases. This is the most common bug in XML-derived data, and it appears in production rather than in testing because test data usually has more than one of everything.

Namespaces and mixed content

XML namespaces exist to let documents combine vocabularies without collision. JSON has no namespaces, so prefixes are either flattened into key names โ€” making them long and awkward โ€” or dropped, which can merge two genuinely different fields into one.

Mixed content, where an element contains both text and child elements, has no clean JSON representation at all. It is common in document-oriented XML such as HTML-like markup, and any conversion of it is a compromise.

Everything arrives as a string

XML has no built-in types outside of a schema, so numbers, booleans and dates are all text. A converter either leaves them as strings, which is safe and inconvenient, or guesses types, which is convenient and occasionally wrong.

Guessing goes wrong in the familiar places: identifiers with leading zeros, version numbers that look like decimals, codes that look like dates. Where the data has a schema, that schema is the authority on types โ€” not the converter's inference.

Why this conversion is so common

XML dominates in enterprise integration, government data, financial messaging, publishing and older APIs. JavaScript and modern web tooling work natively in JSON. The gap between those two worlds is where this conversion lives, and it is not going away.

For a one-off inspection or a small integration, converting is the pragmatic answer. For a long-lived pipeline, parsing the XML directly with a library that understands schemas is more robust than converting first and working with the result.

Checking, and where it runs

Verify a record that has exactly one child element and one that has several โ€” that single comparison catches the array problem. Then check any field carrying attributes, and any identifier that should have kept its leading zeros.

Conversion runs in your browser. XML feeds frequently contain invoices, patient records and financial messages, and none of it is transmitted here.

Written by Mutaf โ€” Developer of RunToolRun. This section is written from the tool's own implementation.

Why Use This XML to JSON Converter?

โœ“Attributes and text nodes preserved
โœ“Repeated elements become proper arrays
โœ“Bridges legacy feeds to modern tooling
โœ“100% local โ€” data stays private

Frequently Asked Questions

How are XML attributes handled?+
Attributes are preserved as prefixed keys inside the element's object, so no information from the XML is lost in translation.
What about repeated elements?+
Elements that appear multiple times under the same parent become JSON arrays โ€” matching how you'd naturally model lists.
Why convert XML to JSON at all?+
Legacy systems, RSS feeds and SOAP services speak XML, while modern tooling speaks JSON. This converter is the bridge when integrating old data sources.
Is malformed XML detected?+
Yes โ€” if the XML doesn't parse, you get an error message rather than silently wrong output.

Related Tools