XML to JSON Converter — Parse XML Online

Parse XML documents and convert them to JSON format. Handles attributes, namespaces, and CDATA sections. Outputs clean, properly typed JSON ready for JavaScript consumption.

Key Features

How to Use

  1. Paste your XML source markup into the input editor.
  2. Configure options such as attribute handling and array grouping.
  3. Click "Convert to JSON" to parse the document.
  4. Examine the resulting JSON object tree.
  5. Copy the formatted JSON or save it for API integration.

Example

Sample input

<user id="7"><name>Sam</name><roles><role>editor</role></roles></user>

Sample output

{"user":{"@id":"7","name":"Sam","roles":{"role":"editor"}}}

Edge Cases

Frequently Asked Questions

How are XML attributes represented in the output JSON?

XML attributes are represented as nested object properties, typically prefixed with "@" or an "_attr" key to distinguish them from child tags.

How are repeated XML tags with the same name handled?

When multiple sibling elements share the same tag name, the converter automatically groups them into a JSON array.

Are namespaces like xmlns:ns retained?

Yes. Namespace prefixes and declarations are maintained in the resulting object keys to prevent property collision.

Related Tools

Privacy notice: when you run this tool, your input is sent over HTTPS to our server, processed in memory and returned. It is not stored or logged. Avoid pasting live secrets such as private keys or passwords.