XML to JSON
Convert well-formed XML to JSON with a documented convention: attributes as @name, text as #text, text-only elements as strings, repeated siblings as arrays.
Convention: attributes → "@name", text → "#text", text-only elements → plain strings, repeated siblings → arrays, root name preserved.
How to use
- Paste XML or choose an .xml file.
- Press Convert — the markup is tokenised, validated and mapped to JSON.
- Copy the JSON or download it as a .json file.
Example
Input: <person id="7"><name>Ada</name><tags><t>x</t><t>y</t></tags></person>
Output: {"person":{"@id":"7","name":"Ada","tags":{"t":["x","y"]}}}
How it works
The XML document is parsed into a tree and each element becomes a JSON object: attributes and child elements become keys, and text content becomes the value.
Limits & compatibility
- Mixed content collects text under #text; element order within a name grouping is preserved.
- Processing instructions, doctypes and comments are skipped.
- Input must have exactly one root element.
Privacy
Conversion runs locally in your browser. Nothing is uploaded.
Related tools
Questions about XML to JSON
Is my input private?
Yes. This tool runs entirely in your browser — your input never leaves your device, is never uploaded to a server and is never stored.
How accurate is the result, and what are the limits?
The tool page states its formula and limits openly. Check them before relying on a result, and verify anything consequential — financial, legal, medical or safety-critical — against an authoritative source.
What happens to files I open with this tool?
Files are processed locally in your browser and never uploaded; closing the tab discards them. Text tools never store what you paste — it lives only in the page while you use it.