XML to JSON

Convert XML to JSON with attributes, repeated elements, and indentation

Last updated: October 14, 2026

How to use

  • Paste your XML code in the input field
  • Adjust indentation settings if needed
  • Click "Convert" to transform XML to JSON format
  • Attributes are converted to "_attributes" objects
  • Use "Copy" to copy the result or "Download" to save as a file
  • Click "Load Sample" to see an example

Result actions

Copy or download the tool output, or share a link to XML to JSON.

Get new tools in your inbox

An occasional email when we ship new free tools. No spam, unsubscribe anytime.

Related tools

Convert well-formed XML to JSON

Paste XML and select Convert. The tool parses the XML document and displays formatted JSON; choose two spaces, four spaces, or compact output. Attributes are grouped in an _attributes object. When a parent has multiple child elements with the same name, those values become an array; a single child stays a single value. Text values remain strings rather than being inferred as numbers or booleans.

Namespaces, text, and whitespace

Namespace prefixes are kept in element and attribute names; the converter does not resolve namespace URIs or treat different prefixes as equivalent. Leading and trailing whitespace in parsed text nodes is trimmed. Review mixed-content XML and whitespace-sensitive documents carefully because converting markup into JSON changes their structure.

Validation and privacy

The parser reports malformed XML but does not validate an XML schema or a receiving application's rules. Conversion runs locally in your browser; the XML is not sent to our servers.