XML to JSON
Convert XML documents into JSON. Nested elements become objects, repeated child tags become arrays, and leaf text content becomes string values. Uses the browser's native DOMParser — no upload, no server.
XML in, JSON out
A small sample to show the shape of the conversion. Pretty-printed output, types preserved where possible.
<root> <name>Alice</name> </root>
{
"root": {
"name": "Alice"
}
}What you'll use this for
XML to JSON shows up in every backend and ETL stack — feeding APIs, migrating configs, debugging payloads.
API & data imports
Prepare payloads for REST APIs and ingestion endpoints.
Data migration
Move configuration and tabular data between systems and formats.
Debugging
Inspect production data in a sensible, structured form.
ETL pipelines
Stage transformations between formats in your data flow.
How to convert XML to JSON
Paste your XML
Drop your source into the left editor. The sample loads on first visit — replace it with your data.
Click Convert
Or leave Auto-convert on for live updates as you type. Conversion runs locally.
Review the output
The right pane shows pretty-printed JSON with status, byte counts, and line count.
Copy or download
Use the action bar to copy to clipboard or save as a file. Or jump to the reverse converter for round-trip checks.
Frequently asked questions
If a parent has multiple children with the same tag name, they collapse into a JSON array. Single children stay as objects.
Not in this simple mode — only element content. For a richer mapping consider x2js or similar.
Plain leaf elements (no children) return their text content as a string. Mixed-content nodes return only their child elements.
Invalid XML triggers an error via DOMParser's <parsererror> element — the error is shown in the output pane.
Yes. All parsing happens in your browser; nothing is uploaded.
About XML to JSON
XML predates JSON and is still everywhere — SOAP, RSS, SVG, Maven POMs, Office documents. JSON is what modern APIs want. This converter does the basic element-tree mapping using the browser's native DOMParser.
How parsing works
- DOMParser builds an in-memory tree from the input.
- Each element becomes a JSON property; child elements become nested values.
- Repeated sibling tags collapse into arrays.
- Leaf elements return their text content.
Use cases
- Inspect XML payloads from legacy SOAP services.
- Pipe RSS/Atom feeds into a JSON-aware tool.
- Translate Maven
pom.xmlstructure for quick reading.