XML to JSON Converter
Convert XML to JSON with attributes, repeated tags, CDATA and namespaces kept. Choose names, types and arrays, and see errors with line numbers.
Convert XML to JSON with attributes, repeated tags, CDATA and namespaces kept. Choose names, types and arrays, and see errors with line numbers.
About this tool
XML to JSON Converter turns XML into JSON without losing data. Paste XML or open a file and the JSON appears as you type. Attributes are kept: an attribute named id becomes @id, and you can choose another mark in front of the name, such as an underscore, or leave attributes out. When a tag has both attributes and text, the text is stored under #text. Tags that appear more than once in the same place become an array, in the order they were written. CDATA sections keep their text exactly, including signs that would otherwise be read as tags. Comments and processing instructions are not data and are left out. Because XML holds only text, you can choose whether numbers, true and false become real JSON values. This is done only when nothing would be lost: a PIN code such as 0248001 keeps its zero, 1.50 stays text because the last zero would disappear, and numbers of more than 15 digits stay text because JavaScript cannot hold them exactly. Always use arrays makes every tag an array, so that code reading the result does not have to handle one item differently from several. Remove namespace prefixes turns soap:Body into Body. Empty tags can become null, an empty text or an empty object. If the XML is not well formed, the message names the line and column and says what is wrong, for example a closing tag that does not match. The result can be indented with two or four spaces or a tab, or written on one line, and you can copy it or download a .json file. One thing JSON cannot express is text mixed with tags in the middle of a sentence, as in documents: all the text is kept, but its position between the tags is not. The conversion happens in your browser with its own XML parser, files can be up to 5 MB, and nothing is uploaded.

Or open or drop an .xml file.
Attributes, types, arrays and namespaces.
It updates as you type.
Take the text or a .json file.
With the mark you choose.
Become arrays in the right order.
Leading zeros and long numbers stay.
Line and column of the mistake.
Old formats, new code
Read a SOAP or XML answer in JavaScript.
ExampleRemove namespace prefixes and use the Body.
Turn RSS or a sitemap into data.
ExampleEvery item or url tag becomes one array entry.
Load an XML export into a database that takes JSON.
ExampleOrders with several item tags become arrays.
Compare an XML setting with a JSON one.
ExampleAttributes are easy to see with @.
Learn why a program rejects a file.
ExampleLine 2, column 7: a closing tag does not match.
See how the two formats compare.
ExampleChange the options and watch the result.
Data you can rely on
A tag that appears once is not an array. Turn on Always use arrays if your code expects one.
If an ID must stay text in every row, turn off number values.
With no mark for attributes, an attribute and a tag of the same name share an array. Keep the @.
Senior Software Engineer · Developer of Toolyconvert
Hemant developed XML to JSON Converter and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.
Last updated 24 November 2026
Featured on
Toolyconvert is listed on these product directories and launch platforms.