XML to JSON
Convert XML files to JSON format.
How to Convert XML to JSON
Paste your XML
Drop an .xml file or paste raw XML โ feeds, configs, SOAP responses, exports.
Conversion runs locally
Elements, attributes and text nodes are mapped to a JSON structure in your browser.
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.