← All tools/Minifiers/Code/XML to JSON Converter

XML to JSON Converter

Paste XML in, get JSON out — elements become keys, text becomes values, attributes get an @ prefix. Nothing leaves your browser.

Paste or type XML here. The JSON updates as you type.

JSON output

JSON ready

1 root element converted

How it works

Parse the XML tree: each element becomes a JSON object keyed by its tag name
Text content becomes the value, attributes become keys prefixed with @, repeated elements become arrays

<book><title>Dune</title><price>499</price></book> becomes {"book": {"title": "Dune", "price": "499"}}. The price stays the string "499" — XML has no number type, so text is kept as text.

Frequently asked questions

How are attributes handled?

Each attribute becomes a key with an @ in front. <book lang="en"> gives "book": {"@lang": "en", ...}.

What happens with repeated elements?

They become a JSON array. Three <item> elements under one parent become "item": [first, second, third].

Are numbers kept as numbers?

No — XML text is always a string, so 499 becomes "499". If your app needs a number, convert it after parsing the JSON.

Is my data uploaded anywhere?

No. The conversion runs entirely in your browser with the built-in XML parser — nothing leaves the page.

More tools

Tell us what you think

Loving this tool, or stuck on something? Tell us — it takes a minute.

We’ll only use your name and email to reply if needed. The tool and page are filled in for you.