XML to JSON Converter

Runs in your browser — your files are never uploaded.

Turn an XML document into clean, readable JSON. Attributes are kept (prefixed with @ so they can never collide with a child element of the same name), element text is preserved, and a tag that appears more than once becomes an array. OkConverter parses the document with the same XML engine your browser uses for the web, so the structure you get back is the structure that was actually there — and because it runs locally, config files, exports and API payloads never leave your machine.

How to convert XML to JSON

  1. 1

    Drop your .xml file onto the box, or click to choose one.

  2. 2

    Pick an indent width if you want the JSON formatted differently from the default two spaces.

  3. 3

    Click “Download” to save your .json file.

Share

Embed this tool on your site

Paste this where you want the tool to appear. It runs entirely in your visitor's browser — no uploads, no account, no tracking.

Please keep the attribution line — it's what keeps these tools free.

Need a different size, a dark theme, or a different tool? Build an embed lets you preview it first.

Frequently asked questions

What happens to XML attributes?+

They become keys prefixed with @ — so <book id="7"> gives you {"@id": "7"}. The prefix exists because XML lets an element have an attribute and a child element with the same name, and without it one would silently overwrite the other.

Why is one element an object and another an array?+

A tag that occurs once becomes an object; the second occurrence promotes it to an array. That means the shape depends on the data — a list with one item looks different from a list with two. If your consumer needs a consistent array, normalise it after conversion; always-array output would be worse for the far more common single-value case.

What about mixed content — text and elements inside the same tag?+

The element’s own text is kept under a "#text" key alongside its children, so nothing is lost. A leaf element with no attributes collapses to a plain string instead, which is what makes the output pleasant to read.

Does it handle namespaces?+

Prefixed names are kept as written — <ns:item> becomes the key "ns:item". The prefix is preserved rather than resolved, so the JSON matches the document you supplied.

Is my XML uploaded?+

No. Parsing and conversion happen entirely in your browser. That matters here in particular — XML is the format of choice for configuration, invoices and system exports, which are exactly the files you should not be pasting into a stranger’s server.