XML to JSON

Parse XML and emit clean JSON, with attributes and text values handled the way you choose.

How it works

  • Attributes are written with the prefix you choose (default @) so they never clash with child elements.
  • Text-only elements become plain string values; elements that have attributes or children keep their text under the key you choose (default #text).
  • Repeated sibling elements are collected into an array automatically.
  • Malformed XML is reported with the reason instead of failing silently.