About XML Formatter & JSON Converter
XML Formatter pretty-prints, minifies, and validates XML, and converts XML ↔ JSON in either direction. Indentation is configurable; element names, attributes, and namespaces are preserved exactly. The same tool ships with an XML→JSON parser that maps elements to JSON properties (with `@attr` for attributes and `#text` for text content by convention), and a JSON→XML emitter that recognises that convention to round-trip cleanly.
Reach for it whenever you are working with the XML half of the web: SOAP envelopes from a legacy API, RSS or Atom feeds, SVG markup, configuration files (`*.csproj`, `pom.xml`, `web.xml`), Android resources, or sitemaps. JSON Formatter is the JSON-only counterpart for pretty-printing JSON; this tool also bridges between the two formats. XML→JSON is lossless when the input has no mixed content; JSON→XML round-trips the JSON convention back into clean XML.
Examples
<order id="42"><item>Notebook</item><qty>2</qty></order><order id="42">
<item>Notebook</item>
<qty>2</qty>
</order>Pretty-print with 2-space indent. The convert pane on the same page emits the JSON shape `{ "order": { "@id": "42", "item": "Notebook", "qty": "2" } }`.
Frequently asked questions
Is XML→JSON lossless?
For documents without mixed content (text and elements interleaved at the same level), yes — the convention with `@attr` for attributes and `#text` for text round-trips back to the original XML. Mixed content (`<p>some <em>bold</em> text</p>`) is harder to represent in JSON and requires a custom convention.
How is this different from JSON Formatter?
JSON Formatter operates on JSON only — pretty-print, minify, validate. This tool does the equivalent for XML and additionally bridges between XML and JSON. Use this one when XML is in the input or output; use JSON Formatter when both sides are JSON.
Will it validate against a schema (XSD, RelaxNG, DTD)?
No. The tool validates well-formedness — that the XML parses — but does not validate against a schema. For schema validation, use a build-time validator or a server-side library; this tool is for quick formatting and shape conversion.
Does it handle SVG?
Yes. SVG is XML, so it pretty-prints and minifies cleanly. For SVG-specific optimisation (removing editor metadata, collapsing default attributes, shrinking path data) use the dedicated SVG Optimizer instead, which calls SVGO under the hood.
