Hand-rolling XML with + and template strings is a trap: the moment a
value contains &, <, or >, you either remember to escape it
yourself or you ship broken XML. Our new
JSON to XML Converter doesn’t take that
risk — it builds a real DOM tree with the browser’s own
document.implementation.createDocument(), createElement, and
appendChild, then serializes it with new XMLSerializer().serializeToString(doc).
- Escaping handled by the DOM, not by hand — text assigned through
el.textContentgets&,<, and>escaped automatically and correctly, because that’s what the API is for. - Arrays repeat sibling elements, no wrapper — a
"tags"array with two entries becomes two sibling<tags>elements, matching how XML is actually written in practice, not one<tags>element containing a list. - Invalid keys are rejected, not silently broken — a JSON key that can’t be a valid XML element name (starts with a digit, contains a space) gets a clear error naming exactly which key failed, instead of emitting XML a downstream parser would choke on.
- You choose the root element name — defaults to
root, but the field above the input lets you name it whatever your target schema expects. - Private by default — the DOM tree and its serialization happen entirely in your browser; nothing you paste is ever sent to a server.
Need the other direction? The
XML to JSON Converter parses real XML
with the browser’s own DOMParser and walks the resulting tree — the
same “let the platform do the parsing” philosophy, mirrored.