
Beautify, minify and validate JSON with clear error messages.
Pretty-print XML and convert between XML and JSON in your browser.
Your files never leave your device. Everything runs in your browser.
XML Formatter pretty-prints XML, converts XML to JSON and turns JSON back into XML, all with the browser's built-in DOMParser. It is useful for reading SOAP responses, feed files, configuration exports and any other XML that arrives as one long line.
Formatting re-indents the document with two or four spaces. XML to JSON follows simple, predictable rules: element attributes become properties prefixed with @, text content becomes #text when an element also has attributes, repeated child elements become arrays, and the root element is kept as the top-level key so the document can be converted back without losing structure. Namespace declarations such as xmlns:h and namespaced names such as h:item are preserved as plain text keys.
The tool validates well-formedness only. Internal entities declared in a DOCTYPE are expanded, external DTDs and external entities are not fetched, and there is no schema validation, so it cannot tell you whether the content matches an XSD.
<note id="1"><to>Ada</to><to>Alan</to></note> produces one element per line with two-space indentation and the two to elements as separate lines.@id and a to array with the values Ada and Alan.#text for the text so it is not confused with the attribute keys.No. Parsing and conversion happen in your browser with DOMParser, so the document never leaves your device.
Each attribute becomes a property whose name starts with @, such as @id or @xmlns:h. Element text becomes #text when the same element also has attributes.
No. The formatter currently drops comments while re-indenting. Keep the original file if comments are important, and check the roadmap in the progress notes for a future option.
No. External resources are not fetched, and an external entity reference makes the document invalid. This is also safer when opening untrusted XML, because it avoids network requests triggered by the document itself.
No. It checks that the document is well-formed XML and that it can be parsed, but it does not check element order, allowed attributes or datatypes against a DTD or XSD.
Namespace declarations and prefixed names are kept as literal text, for example xmlns:h and h:item. Prefixes are not resolved to URIs, which is enough for most display and data-transfer use.
Related convert tools: JSON Formatter, YAML ↔ JSON Converter, CSV ↔ JSON Converter, SQL Formatter.
XML and JSON are parsed and formatted locally with DOMParser — nothing is uploaded.