>_devtools

XML to JSON Converter

Convert XML to JSON with control over attributes, text nodes, arrays, and number conversion.

What this does

Converts XML to JSON. Repeated sibling elements become an array, and an element with both attributes and text gets an object holding both.

Conventions

  • Attributes are keys that start with a prefix, @_ by default: <a id="1"/> becomes {"a": {"@_id": "1"}}. Change the prefix or turn attributes off.
  • Text next to attributes or child elements goes under the text key, #text by default.
  • Values stay strings unless you enable number and boolean conversion, which avoids turning IDs like 007 into numbers.
  • Turn on "Always use arrays" when a consumer needs the same shape whether an element appears once or many times.

Limits

The declaration and processing instructions are dropped, and element order between different element names is not kept. For XML where order matters, keep the XML.

Privacy

Everything runs in your browser. Your input is never uploaded, stored, or put in the URL.