idpixo

XML to JSON Converter

Paste or upload XML to get JSON, with a fixed attribute convention (@name) and list handling for repeated elements. Nothing is uploaded — parsing is local.

How XML maps to JSON

XML is a markup tree; JSON is a data tree, so a converter has to make choices. On this page the rules are fixed and stated up front: element names become keys; attributes become @name keys; text content becomes a #text value when an element also has attributes or children; repeated siblings become an array; comments and processing instructions are skipped; CDATA is read as text. Namespaces are not expanded. This is the format-conversion counterpart to the XML formatter, which beautifies or minifies XML without changing its format. For JSON itself use the JSON formatter, and for text manipulation the text case converter.

Frequently asked questions

Is my XML uploaded anywhere?
No. The conversion runs in your browser with a self-written JavaScript parser. Your XML never leaves your device and nothing is stored between visits.

How are attributes represented in the JSON?
Attributes become keys prefixed with @, so becomes {"@href":"x"}. This convention is fixed on this page so the output is predictable.

What happens to repeated elements?
Repeated sibling elements with the same name are collected into an array, which is the usual way to represent lists such as multiple nodes.

Does it support namespaces?
No. Namespace prefixes are kept as written in the element and attribute names, but prefixes are not expanded or resolved, and DTDs, entity expansion and XSLT are not processed.

What about CDATA, comments and processing instructions?
Comments and processing instructions are skipped, and CDATA sections are read as text content rather than being parsed as markup.

What happens if my XML is malformed?
The output box shows an error with the character position where parsing failed, so you can fix the source and try again.

All tools →  XML formatter →