XML to JSON

Validate XML and convert it into formatted JSON.

Validate XML and convert it into formatted JSON with one click. Attributes become keys prefixed with @, repeated elements become arrays, and mixed text is kept under #text. It is useful when you need to inspect or reuse data from XML feeds, configs and SOAP-style responses in a JSON-based workflow.

What is XML to JSON conversion?

XML and JSON both describe structured data, but they model it differently. XML has elements, attributes and text nodes in a tree, while JSON has objects, arrays and simple values. There is no single standard mapping, so converters follow conventions. Here, each element becomes an object key, attributes appear as keys beginning with @, an element with only text becomes a string, an empty element becomes null, and sibling elements with the same name are grouped into an array. Because JSON objects have no attributes or ordering of mixed content, some detail can be lost in the conversion.

How to use XML to JSON

  1. Paste XML Put your XML into the XML box.
  2. Click Convert to JSON The JSON appears in the JSON box, indented with two spaces.
  3. Fix any error If an error message shows, use the line and column it gives to find the problem.
  4. Copy or download Use the copy button or the download button to save converted.json.

Frequently asked questions

How are attributes represented?

Each attribute becomes a key with an @ prefix, such as @id, next to the child element keys of the same object.

What happens to repeated elements?

Elements with the same name under the same parent are collected into an array. A lone element stays a plain value.

Why was my DOCTYPE rejected?

DTDs and entities can be abused, so the tool refuses them rather than process them. Remove them to convert.

Are numbers and booleans detected?

No. Text values are kept as strings, so 5 becomes the string 5 and true becomes the string true.

Is the root element kept?

Yes. The root element name is the top-level key in the JSON output.