XML to JSON Converter: Convert XML to JSON Online
Converting XML to JSON maps the element tree to JSON objects: element names become keys, attributes are preserved under @attributes, text content becomes values, and repeated sibling elements become arrays. Paste XML and get clean, pretty-printed JSON back, with the conversion running entirely in your browser.
How it works
- 1
Paste your XML document into the editor.
- 2
Click Convert to JSON: the element tree is mapped to a JSON object.
- 3
Copy the pretty-printed JSON output.
Frequently asked questions
How are XML attributes represented in JSON?
Each element with attributes gets an @attributes key holding a name-to-value map. This keeps attributes distinguishable from child elements, and the conversion is reversible for typical documents.
How are repeated XML elements converted?
When the same element name appears multiple times under one parent, the values are collected into a JSON array, so <item>a</item><item>b</item> becomes "item": ["a", "b"].
Is XML to JSON conversion lossless?
Not perfectly, by nature: JSON has no namespaces, comments, processing instructions, or guaranteed key order. For data-centric XML (configs, API payloads) the conversion is effectively complete; for document-centric XML with mixed content, expect simplification.
Can I convert SOAP responses to JSON?
Yes. Paste the SOAP envelope and convert; the Body content becomes nested JSON. Tip: test the service with the SOAP tester, copy the response, then convert it here.
Related tools
Convert JSON to XML online. Objects become elements, arrays become repeated elements, values are escaped correctly. Free and browser-based.
Parse XML online into an explorable tree: elements, attributes, text and namespaces, plus parse-error diagnosis. Free and browser-based, no signup.
Free XML formatter: beautify, pretty-print, tidy and indent XML online, or minify it to one line. Idempotent formatting, no signup, no upload limit.
Convert WSDL to readable XML online: format the document, extract endpoints, schemas and operations, or convert to JSON. Free, no install required.
Create XML online with a form-based generator: build elements, attributes and nesting visually, or generate SOAP envelopes from WSDL schemas. Free.