Skip to content
ToolHub

XML to JSON Converter

Convert XML into JSON, keeping attributes and repeated elements.

J{}
JSON Tools Pro
12 tools ยท Live ยท Same Pattern
๐ŸงฉResult
โ€”
Paste JSON to start
โšก Output
โ€”
History0

About the XML to JSON Converter

The XML to JSON Converter parses XML with your browserโ€™s built-in XML parser and converts it to JSON. Child elements become keys, repeated elements become arrays, attributes are kept under "@attributes", and text in elements that also have attributes or children is stored as "#text".

How to use the XML to JSON Converter

  1. Paste well-formed XML.
  2. Copy the JSON, or read the parser error if the XML is malformed.

Example

Attributes

<item id="7">Pen</item> becomes {"item": {"@attributes": {"id": "7"}, "#text": "Pen"}}.

Frequently asked questions

Are numbers converted?

No. Text content is kept as strings.

What about namespaces?

Prefixed names such as dc:title are kept as written in the key.

Why do I get a parser error?

The XML is not well-formed, for example an unclosed tag or an unescaped &.

Use โ†‘ โ†“ to move, Enter to open.