XML Formatter & XML ↔ JSON Converter


XML Formatting & XML ↔ JSON Conversion Guide

XML remains widely used in SOAP APIs, SAML single sign-on assertions, RSS/Atom feeds, Maven pom.xml files, Android manifests, bank payment messages (ISO 20022), and SVG graphics. Meanwhile, modern web apps and REST microservices almost universally consume JSON. This converter lets you pretty-print minified XML, convert XML documents into structured JSON objects, or turn JSON back into well-formed XML locally in your browser.

How XML Elements & Attributes Map to JSON

Unlike JSON, XML distinguishes between attributes (like <user id="7">), text content, and repeated sibling tags. When converting XML to JSON:

  • Child Elements: Become object keys; repeated sibling tags with the same name automatically group into a JSON array.
  • Attributes: Stored under an @attributes key so metadata like IDs or types is preserved cleanly.
  • Self-Closing & Empty Tags: Converted safely without crashing, and XML special characters (&, <, >) are properly escaped when converting JSON back to XML.

Formatting Tips & FAQ

  • Why does XML formatting fail on unclosed tags? Unlike lenient HTML5 parsers, XML requires strict well-formedness: every opening tag must have a matching closing tag, attribute values must be quoted, and there must be a single root element.
  • How do I inspect a SAML response or SOAP envelope? Base64-decode the payload first (using our Base64 Decoder), then paste the raw XML here and click Format XML to get readable indentation.
  • Is any XML data sent to the server? No. Parsing uses the browser's built-in DOMParser, so sensitive payloads never leave your machine.
Please read the privacy policy (agreement of the cookies usage, other websites embedded content, etc.). If you continue to use the site, we will assume that you agree with our privacy policy.
OkPrivacy Policy