XML → JSON
Parse XML with the browser's own parser and represent it as JSON -- customizable attribute prefix and text key, always-array mode, namespace stripping, type coercion, and a structure summary.
What this tool does
Paste or load XML and it is parsed with the browser's own built-in XML parser, then converted to JSON. Using a real parser rather than a hand-written one means malformed XML is caught with an actual parser error, not a converter quietly guessing at broken markup.
The real ambiguity in XML, made configurable
XML has no single obvious JSON shape, because attributes, child
elements, and text content all need somewhere to go. An
attribute prefix (@ by default) keys
every attribute distinctly from child elements, and a
text key (#text by default) holds an
element's own text when it also has attributes or children — both
are editable, for matching whatever convention a project already
uses.
Keeping array shape consistent
By default, an element that repeats becomes an array and one that appears only once does not — which means code reading the result has to handle both cases, since the same tag might be an array or a single object depending on how many times it happened to appear in one particular document. Always array forces every repeatable element into an array unconditionally, so downstream code can assume one shape regardless of how many times an element shows up.
Namespaces and types
Strip namespace prefixes removes a leading
ns: from element and attribute names when the
namespace itself does not matter for the JSON. Ignore
attributes drops them entirely when only element content
is relevant. Coerce types turns text that looks
like a number or true/false into a real
JSON number or boolean instead of leaving every value as a string,
which is how XML represents everything natively.
Privacy
Parsing and conversion both happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.