XML to JSON Converter
Readable JSON From Any Feed
Paste a feed, an API reply or a config file into this XML to JSON converter and get clean JSON back, with attributes, lists and text all kept.
- FreePrice
- JSONOutput
- NoneSign-up
- In your browserRuns
XML to JSON Converter
Converted in your browser, with every issue listed
- Records
- 0
- Depth
- 0
- Size
- 0 B
Ready. Paste your data, open a file or try the sample.
| Result | Check | Details |
|---|
Going the other way? Convert JSON to XML
Jobs This XML to JSON Converter Handles for You
This XML to JSON converter reads an XML document and rewrites it as readable JSON objects and lists. Tags become keys, the text inside them becomes values, and nothing gets lost. Your browser reads the XML itself, so no file, from any feed or system, ever travels to a server.
XML is older and wordier than JSON, yet it still carries a lot of the world’s data. Bank statements, shipping labels, product feeds and many government systems use it every day. Most web code, on the other hand, prefers JSON. This Denwix page fills exactly that gap.
Swapping brackets for tags is the simple part. It is keeping the meaning: which values were attributes, which elements were lists, and where the text sat. The converter follows one clear set of rules for all three, and then it reports what it found.
How Each XML Part Becomes JSON
Each element becomes a key, and its content becomes the value. An element holding only text turns into a plain value, such as "title": "Midnight Rain". An element holding other elements turns into an object with one key per child.
Attributes keep an @ in front, so id="bk101" becomes "@id": "bk101". When an element has attributes and text together, the text goes under a #text key. Because the same two conventions work in reverse, our JSON to XML converter can rebuild the original file.
Repeated Tags Become Lists Everywhere
XML has no list type. Instead, it simply repeats an element: three tag elements in a row mean a list of three. The converter turns such repeats into a JSON array.

However, a naive converter creates a trap here. A book with two tags gets a list, while a book with one tag gets a plain string, so the JSON changes shape from record to record. This tool spots the pattern and makes the single tag a one-item list as well. As a result, code that loops over the tags works on every book.
XML to JSON With Numbers and Booleans Kept
Everything in XML is text, even a price. By default the converter keeps it that way, which is the safest choice for IDs and codes. Turn on number detection when you want real JSON numbers and booleans instead.

Type detection turns 44.95 into a number and true into a boolean. Values with a leading zero, such as a zip code, still stay text, because turning them into numbers would change them.
Feeds, Sitemaps and SOAP Replies
An RSS feed is a channel element with a list of item elements inside. After conversion, you get a channel object with an item list, so each post has its title, link and date side by side. A sitemap works the same way: every url element becomes one entry, with its loc and lastmod as keys.
SOAP replies from older payment and shipping APIs wrap the useful data in several envelope layers. The converter keeps every layer, including namespace prefixes such as soap:Body. That way you can see the full structure first, and then pick the part your code needs.
Namespaces never collide, because the prefix stays part of the key. As a result, g:price from a product feed and price from the main document remain two separate keys.
Safe With Untrusted XML
Some XML files declare their own entities in a DOCTYPE. A hostile file can use them to pull in local files or to expand into millions of characters. Security teams know this as the XXE attack described by OWASP.
This converter never expands those entities, and the checks table tells you when a file tried to declare them. Since the reading also happens inside your browser, the file cannot reach anything on this site.
What Happens When the XML Breaks the Rules
A missing closing tag, an unescaped ampersand or two root elements make XML invalid. The converter stops, shows the reason, and names the line and column. Then Show me where puts the cursor right on it, so the fix takes seconds.

XML to JSON in the Browser, One Step at a Time
Developers use the conversion to test an old SOAP or payment API from modern code. Marketers use it to read a product feed or a sitemap without opening an XML editor. Analysts turn a government export into JSON, then load it into a notebook or a dashboard.
The rules for well-formed XML live in the W3C XML specification, and this reader follows them strictly. Once you have the JSON, our JSON formatter can indent it, sort its keys or squeeze it onto one line.
Turning XML Into JSON on Denwix
From feed to JSON in less time than it takes to open an editor.
- 1
Add the XML
Paste it, drop an .xml file on the box, or open one. The sample is a small book catalog.
- 2
Choose the types
Leave number detection off to keep every value as text, or turn it on for real numbers.
- 3
Read the checks
See which lists were kept, which entities were ignored and how deep the data goes.
- 4
Take the JSON
Copy it or download a .json file, indented or on one line.
JSON You Can Actually Code Against
Predictable shapes matter more than pretty output. These features keep the JSON predictable.
Attributes never lost
Every attribute lands under an @ key right beside the element it belonged to.
Consistent lists
A tag that repeats anywhere becomes a list everywhere, even with one item.
Text kept in place
Text beside attributes goes under #text, so none of it disappears.
Optional real types
Numbers and booleans on request, while codes with leading zeros stay text.
Entity attacks blocked
DOCTYPE entities are never expanded, and the checks say when a file tried.
Exact error lines
When the XML is broken, the converter names the exact line and column.
Rules for XML That Converts Cleanly
Nearly every odd conversion result comes down to one of these points.
- Keep exactly one root element. Everything must sit inside a single outer tag, or the XML is not well formed.
- Close every tag. Each opening tag needs a matching closing tag, or it must close itself with />.
- Escape ampersands in text. Replace a plain & sign with its entity, or the parser reads it as the start of one.
- Match tag names exactly. XML is case sensitive, so an opening Price and a closing price do not match.
- Quote every attribute value. Both single and double quotes work, but a bare value breaks the file.
- Save the XML as UTF-8 before pasting. It holds every script, and it matches the declaration most files carry.
- Avoid custom entities. The converter ignores them for safety, so spell the text out instead.
- Check the depth. A deeply nested file becomes deeply nested JSON, which is harder to use.
Six XML to JSON Mistakes
Each one produces JSON that looks fine until code tries to read it.
Dropping attributes
Some converters throw attributes away, so IDs and currencies vanish.
Lists that change shape
One record gets an array and the next a string, and loops break.
Losing mixed text
Text beside attributes disappears unless it gets its own key.
Rounding codes
Turning 00123 into the number 123 changes an order code for good.
Expanding entities
A parser that follows DOCTYPE entities can leak files or freeze.
Guessing past errors
Silently fixing broken XML hides the real problem in the source system.
Questions About the Denwix XML to JSON Converter
What are the steps to turn XML into JSON on Denwix?
Paste the XML into the input box or open a file. The JSON appears beside it, ready to copy or download.
How does the converter mark XML attributes in the JSON?
Each one becomes a key with an @ in front, placed inside the object for its element. For example, id="7" becomes "@id": "7".
Why does the JSON contain a #text key?
When an element has attributes and text, the text needs a name in JSON. The converter uses #text, a widely used convention.
Why is a single item shown as a list?
Because the same element repeats somewhere else. Keeping it a list means every record has the same shape.
Why are my numbers in quotes?
XML stores everything as text, and the converter keeps it that way by default. Turn on number detection to get real numbers.
Are XML namespaces kept?
Yes. Prefixed names such as g:price stay exactly as written, and xmlns declarations appear as @ keys.
What about comments and CDATA?
The converter leaves comments out, since JSON has no place for them. It reads CDATA sections as ordinary text.
Can I convert an RSS feed or sitemap?
Yes. Paste the feed or sitemap XML and each item or url element becomes an entry in a list.
Why did the converter stop at a closing tag?
The closing tag does not match the tag that is open at that point, perhaps because of a typo or a missing close earlier. The message names both tags and the line where the open one started.
Can I keep every value as text?
Yes. Denwix switches that on for you. Leave number detection off, and every value stays a string exactly as it appears in the XML, including prices, dates and codes.
Does it read HTML too?
Only XHTML, which follows XML rules. Ordinary HTML allows unclosed tags such as <br>, so the strict reader stops on them by design.
How large a file will this Denwix tool accept?
Files of several megabytes convert well. Very large input converts when you press the button rather than on every key.
Does my XML leave my computer?
No. The browser reads and converts it on your own device, and nothing goes to this site.
More Tools for Working With XML and JSON
Useful once the JSON is ready.
JSON to XML Converter
Go the other way, with attributes and a valid root.
Open tool →JSON Formatter
Indent, sort or minify the JSON you just made.
Open tool →XML Sitemap Generator
Build a clean sitemap file for search engines.
Open tool →
Ready to Read Your XML as JSON?
Paste the XML and clean JSON appears straight away. The XML to JSON converter is free, needs no sign-up and keeps the file on your device.