ToolBark
Converters

XML to JSON Converter

Convert XML to clean, readable JSON instantly

Conversion rules

  • XML attributes are prefixed with @ (e.g. @id).
  • Repeated sibling tags of the same name are merged into a JSON array.
  • Numeric, boolean (true/false), and null values are automatically coerced.
  • Mixed content nodes store text in a #text key.
About

Need to convert XML to JSON quickly? This free online XML to JSON converter parses any valid XML document in your browser using the native DOMParser API and outputs clean, formatted JSON. Attributes are prefixed with @, repeated sibling tags become arrays, and primitive values like numbers and booleans are automatically coerced — no server uploads, no dependencies, instant results.

FAQ
How are XML attributes handled in the JSON output?+

Each XML attribute is mapped to a JSON key prefixed with @ — for example, an attribute id="1" becomes "@id": 1 in the output object. This follows a widely-used convention that keeps attributes distinct from child element data.

What happens when multiple sibling elements share the same tag name?+

Repeated sibling elements with the same tag name are automatically grouped into a JSON array. For example, three <book> elements inside <library> will produce a "book" key whose value is an array of three objects.

Are numbers and booleans converted from strings?+

Yes. The converter automatically coerces values: "true" and "false" become JSON booleans, numeric strings become JSON numbers, and empty strings become null. All other values remain strings.

Does this tool send my XML data anywhere?+

No. Everything runs entirely in your browser using the built-in DOMParser API. No data is uploaded to any server, making it safe for sensitive or internal XML documents.

Related tools