trentyx@local:~/data-converters/xml-json-converter $ run xml-json-converter_

Convert between XML and JSON bi-directionally using native browser DOMParser. Preserves attributes (@attr), text nodes (#text), CDATA, and repeating elements. 100% browser-based.

💡 How XML Attributes & Text Content are converted to JSON

XML Attributes (e.g. <user id="123" role="admin">) convert to keys prefixed with @ (e.g. "@id": "123", "@role": "admin").

Text Content mixed with attributes or child elements converts to "#text" (e.g. "#text": "Content").

Repeating Elements with identical tag names (siblings) automatically become JSON arrays.

XML Comments (<!-- ... -->) are skipped during conversion to JSON.

input.xml
output.json

Paste data on the left and press Convert to see the result here.

Why Convert Between XML and JSON?

XML (Extensible Markup Language) and JSON (JavaScript Object Notation) are widely used data interchange formats. While XML has historically powered legacy enterprise systems, SOAP web services, and RSS feeds, JSON has become the standard for modern RESTful APIs and front-end web development. Converting XML to JSON allows legacy data to be easily consumed by JavaScript applications, while JSON to XML conversion helps feed data back into legacy enterprise software.