XML to JSON Converter

Convert XML to JSON without losing attributes or text nodes

Runs in your browserUtility02Converters

What is XML to JSON Converter?

This XML to JSON converter maps tag structure onto JSON objects: attributes are preserved under an @ prefix, the text of mixed content goes into #text, and sibling elements sharing a name are merged into an array. Parsing uses the built-in browser DOMParser and happens entirely on your own machine.

How to use XML to JSON Converter

  1. 1Paste your XML document or SOAP envelope.
  2. 2Read the output: attributes appear as @name, text as #text, and repeated tags as arrays.
  3. 3Switch to "Minify" to collapse the result onto a single line.

Frequently asked questions

Why are attributes given an @ prefix?+

In XML an attribute and a child element are allowed to share the same name, so expanding both straight into object keys would let one silently overwrite the other. The @ prefix is the established convention, used by BadgerFish and similar specifications, and it keeps the conversion lossless and reversible.

Why is a single child element not wrapped in an array?+

XML itself draws no distinction between one element and a list that happens to contain one element, so the converter has nothing to go on. If your downstream code expects an array, normalize the shape in your own code or switch to a schema-aware converter.

Related tools

All tools