Paste XML and get clean, indented JSON, or paste JSON and get well-formed XML. Attributes become keys with a prefix of your choice, repeated tags become arrays, and an XML mistake is reported with its line and column. Use it to reshape a product feed, a sitemap, an RSS file or an old API response before you load it into a new app.
XML was designed for documents. It has attributes, text that can sit between tags, comments and namespaces. JSON was designed for data and has objects, lists, numbers, booleans and null. Any converter has to make choices where the two disagree, and different tools make different choices, which is why the same file can give different JSON depending on where it was converted.
The convention used here is the common one. Attributes get a prefix so they cannot collide with child tags, text sits under a named key, and repeated tags form a list. If the receiving code already expects a specific shape, adjust the prefix and the text key to match instead of reshaping the data afterwards.
Strict XML parsers refuse input that browsers would forgive in HTML. Every tag must be closed, tags must close in the opposite order they opened, attribute values must be quoted, and there can be only one root element. The error message here gives the line and column where the parser gave up, which is usually at or just after the real mistake.
A bare ampersand is the most common culprit in hand-written feeds. A company name like Smith & Sons must be written Smith & Sons. The same goes for a less-than sign in text. If you control the source, wrap long free text in a CDATA section so these characters need no escaping.
Each attribute becomes a key made of your prefix and the attribute name. With the default prefix, <book id="7"> becomes {"book": {"@id": "7"}}. If the element also has text, the text goes under the text key, #text by default.
Sibling tags with the same name become an array in the order they appear. Two <item> tags give "item": ["a", "b"]. A single <item> gives just a value, which is a limit of the format since XML does not say whether a tag may repeat.
Yes. The five standard entities (< > & " ') and numeric references like © are decoded, CDATA sections are read as plain text, and comments, processing instructions and the DOCTYPE line are skipped. Custom entities defined in a DOCTYPE are not expanded and are reported as errors.
An object with one key supplies the root tag. Keys starting with the attribute prefix become attributes, arrays become repeated tags, null becomes an empty tag and text is escaped. If your JSON has several top-level keys or is an array, it is wrapped in a root tag.
No. Parsing and conversion happen in your browser and nothing is sent anywhere.
Related: JSON formatter, XML sitemap generator, JSON to CSV converter.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.