XML to JSON converter.
Paste XML on the left, get JSON on the right. Free, instant, and private — the conversion runs entirely in your browser using its built-in XML parser, so nothing is uploaded anywhere.
The mapping in one line: attributes become @name keys, repeated elements become arrays, text next to child elements lands under #text, and comments are dropped. Hit Sample to see all four.
Going the other way? JSON to XML converter → · All free tools →
Do more with the JSON you just made
Converting XML to JSON is usually step one — the real work is reading what's inside. The jsonbolt desktop app is a GPU-accelerated JSON viewer: it opens clipboard JSON with one keystroke, parses at 3 GB/s, and searches 20 million results a second, on documents far bigger than a browser tab can hold.
Copy the JSON
One click on Copy above — or copy JSON from a terminal, an API client, a log file.
Press Win + J⌃ ⌥ J
jsonbolt launches and opens your clipboard in one step — even a 1 GB payload renders instantly. (Opt-in: Settings → Launch.)
Explore & export
Search the tree, extract any subtree by path, and export the selection as CSV, YAML — or back to XML.
Free for personal use — no signup. YAML, CSV, and XML export are built in.
How XML maps to JSON
XML and JSON disagree about the basics — XML has attributes, mixed content, and comments; JSON has arrays and types. This converter uses the most common convention so the output is predictable:
| XML | JSON |
|---|---|
| Element with children | Object, keyed by child names |
| Attributes | "@name" keys on the element's object |
| Repeated sibling elements | An array under the shared name |
| Text-only element | A plain string |
Empty element <a/> | null |
| Text beside child elements or attributes | "#text" key |
| CDATA sections | Their text content |
| Comments, processing instructions | Dropped — JSON has no equivalent |
Namespaced names (ns:tag) | Kept verbatim, prefix and all |
How this converter handles the details
- Values stay strings. XML has no types, so
"8080"stays a string instead of being guessed into a number — version numbers, IDs, and ZIP codes survive intact. Types are your call after conversion. - Real parser, real errors. The browser's own XML parser checks well-formedness — unclosed tags and mismatched nesting produce a precise error, not garbage output.
- Whitespace-only text between elements is ignored, so pretty-printed XML doesn't fill your JSON with
"#text": "\n "noise. - The @/#text convention round-trips. Feed the output to our JSON to XML converter and attributes and text land back where they started.
- Everything runs locally. Your data never leaves the tab.
FAQ
How do I convert XML to JSON?
Paste your XML into the input pane at the top of this page. The JSON equivalent appears instantly in the output pane — copy it to your clipboard or download it as a .json file. The conversion runs locally in your browser.
How are XML attributes represented in JSON?
Each attribute becomes a key prefixed with @ — <server port="8080"> becomes {"server": {"@port": "8080"}}. When an element has both attributes and text, the text lands under the "#text" key.
Why are all the values strings in the JSON output?
XML has no data types — every value is text. This converter keeps them as strings rather than guessing, so "1.10" doesn't silently become 1.1 and version numbers, ZIP codes, and IDs survive intact.
How does the converter decide what becomes a JSON array?
Repeated sibling elements with the same name become an array: two <port> elements produce "port": ["8080", "9090"]. A single occurrence stays a plain value — check the sample to see both.
Is my XML uploaded to a server?
No. The converter uses your browser's built-in XML parser and runs entirely locally. Your data never leaves your machine.
How do I explore a large JSON file after converting?
Copy the JSON output and press Win + J⌃ ⌥ J — the jsonbolt desktop app launches and opens your clipboard instantly. It parses at 3 GB/s, searches 20 million results per second, and can extract any subtree or export it as CSV, XML, or YAML.