XML to JSON

Parse XML into JSON for JavaScript apps and APIs.

How XML to JSON works

Convert XML documents into JSON objects, with repeated tags turned into arrays. Everything happens inside this page: the tool reads your input, runs the calculation or conversion locally, and hands the result back to you. Nothing is transmitted, because there is no backend to transmit it to.

That design choice is deliberate. Most free tool sites upload your files to a server, process them there, and quietly keep a copy. Toolcin cannot do that — the site is a set of static files. If your connection dropped the moment the page finished loading, every tool would still work.

Repeated tags become arrays

This is the important rule. XML expresses a list by repeating a tag; JSON needs an array. When a tag appears more than once inside the same parent, the converter collects it into an array, which is what an API consumer expects.

A single occurrence stays a plain value rather than a one-element array, so the shape depends on the data. That is convenient for reading and awkward for strict schemas — if the consumer expects an array, wrap it yourself.

Errors are reported, not guessed

The document is parsed with the browser's XML parser before conversion. A parser error — an unclosed tag, an unescaped ampersand, two root elements — stops the conversion with the message, rather than producing JSON from half a document.

That is the correct behaviour: silently repairing malformed XML produces data that looks valid and is not.

XMLJSON
<r><n>A</n></r>{"r":{"n":"A"}}
<r><i>a</i><i>b</i></r>{"r":{"i":["a","b"]}}
<r><n>5</n></r>{"r":{"n":"5"}} — string

What gets lost

Attributes, namespaces, comments and CDATA are dropped or folded into text. A document that carries its meaning in attributes — a common pattern in SVG and in SOAP — will lose that meaning entirely.

Everything also becomes a string: XML has no number type, so "5" stays text and arithmetic on it later needs a cast.

Good to know

  • Works offline once loaded, including on flights and in locked-down networks.
  • No file size limit beyond your device's own memory.
  • Free to use, with no account and no usage counter.
  • Results are produced locally, so they are not logged or shared with anyone.

Questions

What happens to repeated tags?

They become an array of values.

Are attributes included?

No — only element names and text content are converted.

Does it keep attributes?

No. Convert those with a schema-aware tool if they matter.

Why is my single item not an array?

Because it appeared once. Repeat the tag in the source if the consumer needs an array.

Keep going

More files tools