Nouplo

XML to JSON

With the rules stated, so nothing surprises you.

Output
Paste or type above to see the result here.

Your files stay on your device

This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.

How it works

  1. Paste the XML.
  2. Choose whether to keep the root element as the outermost key.
  3. Read the JSON. Attributes appear as @name and any loose text as #text.
  4. Copy it.

Frequently asked questions

What happens to attributes?
They become keys prefixed with @, so <a id="1">text</a> becomes {"@id": "1", "#text": "text"}. There is no way to express an attribute in JSON, so every converter invents a convention; this uses the one most of them settled on.
Why did one element become an array and another not?
Because XML has no way to say “this is a list of one”. A name appearing twice inside the same parent becomes an array; appearing once, it stays a single value. If your consumer always expects an array, it has to cope with both — that ambiguity is in the XML, not in the conversion.
Are the numbers converted?
No. Everything comes out as a string, because XML has no types and guessing produces the classic bug where a version number like 1.10 becomes 1.1 or a leading zero is lost from an identifier.
Does it handle CDATA and entities?
Entities are decoded — &amp; becomes &. CDATA sections come through as their text. Comments and processing instructions are dropped, because they have nowhere to go in JSON.
Is anything sent to a server?
No. It runs in your browser, so what you type stays on your computer.

Related tools