XML to JSON

Convert XML into JSON, with optional attribute handling. Free, in your browser.

Parses XML into JSON in your browser, with optional attribute handling.

Free to use — premium coming soon

FREE
  • Attribute handling
  • Formatted JSON
  • 100% private
PREMIUM
  • Remove ads
  • Namespaces & advanced options

About the XML to JSON

The XML to JSON converter turns angle-bracket markup into the lighter, key-value structure that powers modern JavaScript apps and REST APIs. You paste an XML document and get back JSON where elements become object properties, repeated tags collapse into arrays, and text content lands inside each node. It exists because the two formats think differently: XML is document-oriented, built for validation, namespaces, and mixed prose-and-markup; JSON is data-oriented, with native objects, arrays, numbers, and booleans. Conversion bridges that gap so data trapped in an XML feed or legacy response can flow into code that expects JSON.

Reach for this tool whenever something upstream still speaks XML but your code speaks JSON. SOAP web services (common in banking, healthcare, and ERP systems) return XML envelopes by definition, and RSS and Atom feeds are XML standards you must parse to read. Build files like Maven's pom.xml, Spring's applicationContext.xml, Android layouts, and SVG graphics are all XML too. Rather than write a brittle parser, drop the payload here, convert it to JSON, and pipe the result straight into JavaScript, a database, or a dashboard. It is also handy for eyeballing a tangled XML response in a flatter, more readable shape.

Under the hood the converter walks the XML tree and applies a consistent mapping. Because JSON has no concept of attributes, each attribute is moved into a property, conventionally prefixed so it does not collide with child elements (the widely used convention prefixes attributes with @, while the BadgerFish style adds @ for attributes and $ for text). Elements that repeat under the same parent are gathered into a JSON array, since JSON distinguishes objects from arrays even though XML does not. Text inside an element with attributes is stored under a dedicated key, and CDATA sections are unwrapped into plain strings.

A few things are worth knowing for accuracy. XML to JSON is not always perfectly reversible: comments, processing instructions, and the XML declaration have no JSON equivalent and are usually dropped, and a tag that appears once may be read as a single value or a one-item array depending on the rules, so downstream code should not assume one or the other. Namespaces are typically simplified by keeping only the local name (so soap:Body becomes Body). On privacy: this converter runs entirely in your browser. Your XML is parsed locally and never uploaded, which matters when the document carries credentials, customer records, or internal config.

Frequently asked questions

How are XML attributes represented in the JSON output?

Because JSON has no attributes, each attribute becomes a normal property, conventionally prefixed (commonly with @) to keep it separate from child elements. For example, <book id="123"> becomes something like {"book": {"@id": "123"}}.

Why does a single XML element sometimes become an array and sometimes not?

XML has no array type, so converters infer arrays from repeated tags. An element that appears multiple times collapses into a JSON array, but one that appears only once is often kept as a single value. To be safe, write code that handles both, or normalise the structure after conversion.

Can I convert the JSON back to the original XML exactly?

Not always. XML to JSON loses information that JSON cannot store, such as comments, processing instructions, the XML declaration, and strict element ordering. The data round-trips, but the exact original markup usually cannot be perfectly reconstructed.

What happens to XML namespaces during conversion?

JSON has no native namespace concept. Most converters strip the namespace URI and keep only the local name for readability, so an element like <soap:Body> typically becomes a plain "Body" key in the JSON.

Is my XML uploaded to a server?

No. The conversion happens entirely in your browser using the local XML parser, so your document is never sent anywhere. That makes it safe for sensitive payloads like SOAP responses or configuration files containing secrets.

From our blog

Minify, Then Compress: How to Actually Make Your CSS Smaller

By the Super Simple Digital Tools Team · Updated June 2026

Most advice about shrinking CSS treats 'minify' and 'compress' as the same task, but they solve different problems. Minification is a syntactic cleanup: it deletes the characters a browser ignores anyway, like comments, indentation, and the optional semicolon before a closing brace. Compression, the gzip or Brotli step your web server performs, is a byte-level algorithm that spots repeated strings and replaces them with short back-references. One reshapes the text; the other re-encodes it. Understanding the split is the key to not over- or under-optimizing your stylesheets.

The numbers tell the story. On a typical framework stylesheet, minification alone removes only a modest share of the bytes, because comments and whitespace are a small fraction of a dense CSS file. Gzip, by contrast, can cut the same file dramatically since CSS is full of repeated property names and values. So if you could only pick one, gzip wins by a wide margin. The catch is that you do not have to pick. Doing both yields a file smaller than gzip alone, and minification also trims the time the browser spends parsing, since it no longer steps over comments and formatting.

The practical workflow is to put minification in your build and leave compression to the server. Keep your readable, commented source in version control, and generate the minified file as an output you never edit by hand. For a quick one-off, a paste-in browser tool like this one is perfect: drop in the CSS, copy the minified result, and ship it. For an ongoing project, wire a minifier into your bundler or a PostCSS step so every deploy produces optimized CSS automatically without manual effort.

Compression is usually already on, but it is worth confirming. Check your responses for a Content-Encoding header of gzip or br; most CDNs and modern servers enable it by default for text assets including CSS. If it is missing, turning it on will do more for your file sizes than any amount of minifying. Once both are in place, the remaining wins come from sending less CSS in the first place, such as removing unused rules and splitting out critical styles, rather than squeezing the formatting harder.

Finally, plan for debugging before you minify. Minified CSS is unreadable, so when something breaks in production you want a source map, a separate file that maps each minified position back to your original line and column so DevTools can show the code you actually wrote. Build tools generate these automatically; a simple paste-and-minify utility does not. Many teams ship external or hidden source maps to production because the map only loads when DevTools is open, so it costs visitors nothing while making live issues far easier to trace.

  • Always keep your original, commented CSS in version control and treat the minified file as a regenerated build artifact, never as something you edit directly.
  • Confirm your server sends Content-Encoding: gzip or br for CSS; compression saves far more bytes than minification, and both together beat either alone.
  • Watch whitespace-sensitive values such as content: " " in pseudo-elements, and diff the rendered page, not just the file size, before deploying minified output.
  • For ongoing projects, run minification through a bundler or PostCSS so it happens on every build and can emit source maps for debugging.

Read the full guide →

Tool by the Super Simple Digital Tools Team. Reviewed by our editorial team. Free to use, no signup required.

Related tools