Free XML to JSON and JSON to XML Converter
This free converter turns XML into readable JSON and JSON back into XML. Attributes become keys that start with an at sign, repeated elements become arrays, and text mixed with attributes is kept under a text key. XML that declares a DOCTYPE or entities is refused for safety. It suits developers reading feeds, sitemaps and API responses.

XML to JSON Converter
Generators and Converters
About this tool
XML and JSON describe data differently, so a conversion needs rules. Here they are simple and the same every time: each element becomes a key, an element that repeats becomes an array, attributes are written as keys starting with an at sign, and when an element has both attributes and text the text is stored under a key called #text.
Going from JSON to XML uses the same rules in reverse. Choose a root element name, keys that start with an at sign become attributes, arrays become repeated elements, and characters that are not allowed in XML names are replaced with underscores. Special characters in values are escaped, so the output is well-formed.
For safety the converter refuses XML that contains a DOCTYPE or ENTITY declaration, which are the building blocks of entity expansion and external entity attacks. Feeds, RSS, product data and sitemaps do not need them. The tool never loads anything from the network, input is limited to 500 KB and nothing you paste is stored.
Frequently asked questions
How are XML attributes shown in JSON?
As keys that begin with an at sign, for example @id. If an element has attributes and text, the text is stored under the key #text. An element with only text becomes a plain string value, which keeps simple data compact.
What happens with repeated elements?
When the same element name appears more than once under one parent, the values are collected into a JSON array in document order. If it appears once, it is a single value, so the shape can differ between files with one and many items.
Why was my XML refused?
The converter does not accept documents with a DOCTYPE or ENTITY declaration, because those can be used to read local files or to blow up memory. Remove the declaration, or paste only the element tree, and convert again. Ordinary RSS, Atom and sitemap files convert without changes.
Can I convert JSON back to XML?
Yes. Switch the direction, set the root element name and paste your JSON. Arrays become repeated elements, keys starting with an at sign become attributes, and invalid characters in names are replaced with underscores so the XML stays well-formed.
