XML to JSON converter.
The conversion runs entirely in your browser, nothing is uploaded. Going the other way? JSON to XML converter →
Do more with the JSON you just made
The jsonbolt desktop app opens clipboard JSON with one keystroke, even documents far bigger than a browser tab can hold. It can search millions of results a second.
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. (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.
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 millions of results a second, and can extract any subtree or export it as CSV, XML, or YAML.