XML to JSON Converter
Convert XML files into JSON format instantly. Pasted text and uploaded files stay in your browser.
Your JSON output will appear here.
How to Convert XML to JSON
Paste XML text or upload an XML file, then click Convert XML to JSON. The converter preserves nested elements, repeated tags, attributes, and text locally in your browser. If your XML mixes plain text with tags, turn on Keep text and tags in original order.
Need the reverse conversion? Try JSON to XML
Convert XML in three steps
Paste or upload XML
Paste XML directly or upload a .xml file into the input editor.
Click Convert
The tool checks tags and transforms the XML document into structured JSON.
Copy or download JSON
Copy the result or download output.json for your project or API request.
XML to JSON Example
XML attributes appear as @ fields, repeated tags become JSON arrays, and text content is kept as #text when needed.
<book id="42"> <title>XML Fundamentals</title> <tag>XML</tag> <tag>JSON</tag> </book>
{
"book": {
"title": "XML Fundamentals",
"tag": ["XML", "JSON"],
"@id": "42"
}
}XML vs JSON
| XML | JSON |
|---|---|
| Uses tags and attributes | Easy to read as objects and fields |
| Supports mixed text | Often smaller and easier to use in web apps |
| Common in documents and feeds | Common in websites, apps, and data tools |
Frequently asked questions
What is an XML to JSON converter?
It transforms XML elements, attributes, text, and repeated tags into a JSON object that is easier to copy, read, and use in other tools. Need the opposite direction? Use JSON to XML.
How do I convert XML to JSON?
Paste XML into the input, or upload a .xml file, then click Convert XML to JSON. Afterward you can review differences with JSON Compare or tidy output in JSON Formatter.
Can XML be converted to JSON?
Yes. Both formats represent structured data, although XML tags and attributes need to be mapped to JSON keys.
How do I convert an XML file to JSON?
Upload a .xml document or paste its contents. The conversion runs locally and produces a downloadable JSON file.
Does this XML converter upload my files?
No. Pasted XML and uploaded files are parsed in your browser. Some XML URLs may not load if the website blocks browser access.
What do @id and #text mean in the output?
XML attributes use the @ prefix and text inside an element with attributes or children uses the #text key.
How do I keep mixed XML text in order?
Turn on Keep text and tags in original order when plain text and child tags are mixed together, such as Hello <b>world</b>.