Nothing you open here is ever uploaded

Convert XML to JSON

The root element becomes the top-level key and the tree under it keeps its shape. Attributes sit alongside the child elements and every value arrives as a string. If the document does not parse you get the XML parser message from the browser itself, cut down to its first line, rather than an empty box. The output updates as you type.

This page loads no libraries at all. The work is done by the browser itself. Your file is read on your own machine and never sent anywhere. Open your browser’s network tab and watch while you use it.

Questions

What happens to attributes?

They become keys with an @ in front, so an id attribute is @id. An element that carries attributes and text but no child elements keeps its text beside them under #text, so neither one displaces the other. An element with attributes and no text comes out as an object of attributes alone.

Are repeated tags always an array?

Only from the second one onwards. A list holding one item comes out as a plain object and the same list with two comes out as an array, so whatever reads the result has to handle both shapes.

What about text mixed in with child elements?

It is lost. Once an element has element children, only those children and its attributes come across. Loose text sitting between the tags does not, and there is no #text to hold it. Whitespace around a value is trimmed as well.

Are numbers and dates converted?

No. A year comes out as the string 1965 and an empty element as an empty string. Nothing is coerced into a type, so decide about types where you use the JSON.

Other data & spreadsheets tools

Everything here is free and works the same way, in your browser.

New tools, once in a while

A new DeskKit tool lands every week or two. Leave an address to hear about it. Nothing else is ever sent, and one click removes you.