XML vs JSON
XML is verbose but strict — it has attributes, namespaces and a formal spec. JSON is compact and native to JavaScript. Most modern systems speak JSON, but legacy enterprise systems (SOAP, RSS, config exports) still emit XML — hence the eternal converter. This tool handles the practical subset: elements, attributes, text, nesting, and CDATA-ish text content.
Conversion rules used here
- Attributes become keys prefixed with
@(e.g.@id) so they never collide with child elements. - Text content becomes
#textwhen an element has both attributes and children. - Repeated elements become arrays.
- JSON → XML reverses the mapping:
@key→ attribute,#text→ text content.
Formatting & validation
Format pretty-prints any XML with proper indentation using the browser's DOMParser (and reports parse errors with line hints). Validate checks well-formedness — not schema validity (that needs an XSD; no way to do it fully static). For config-family formats see YAML and TOML tools.