Logo

XML to JSON Converter

Convert XML to JSON with @-prefix attributes and automatic arrays. Compatible with xml2js and xmltodict conventions.

XML to JSON Converter

Convert XML to JSON using the @-prefix convention for attributes (compatible with xml2js and xmltodict). Repeated elements become arrays automatically.

Convention: Attributes are prefixed with @, text content uses #text, comments use #comment.

Arrays: Repeated sibling elements are automatically converted to arrays.

How does XML to JSON conversion work?

XML and JSON model data differently: XML has attributes, mixed content, and repeated elements that have no direct JSON equivalent. This converter follows the widely-used convention where attributes become @-prefixed properties, element text becomes a #text property when mixed with children, and repeated sibling elements collapse into arrays.

The output is compatible with the conventions used by xml2js (Node.js) and xmltodict (Python), so converted documents behave predictably if you feed them to tooling built around those libraries.

Features

  • Attributes mapped to @-prefixed JSON properties
  • Repeated sibling elements automatically become arrays
  • Optional type inference for numbers, booleans, and null
  • Handles namespaces and nested structures
  • Runs in the browser — no data uploaded

When to use it

Use it when migrating an XML-based API to JSON, inspecting SOAP or RSS feeds in a JSON-friendly tool, feeding XML data into JavaScript applications, or quickly checking how a document will look after a programmatic conversion.

Privacy & Cookie Preferences

We use cookies to enhance your experience, analyze site performance, and support our marketing efforts. Your privacy matters, and you can withdraw consent at any time.