Format, minify or convert XML to JSON as you type, with line-and-column error checks, a tree view and XPath queries that handle namespaces.
Initializing in your browser…
Format, validate and minify JSON, JSONC or JSON5 as you paste, with exact numbers, precise error locations, a tree view, JSONPath queries and schema checks.
Format and validate YAML or convert between YAML and JSON as you type, keeping comments, anchors and exact numbers, with YAML 1.1 and 1.2 support.
Minify or beautify JavaScript, TypeScript, CSS, HTML, JSON, XML and SQL as you type, without touching strings or licences, and see the bytes saved.
An order export arrives as one long line of XML and you need to check the items before it is sent to the warehouse.
One-line XML
<order id="A-17"><customer>Ana Silva</customer><item sku="KB-2" qty="1">Keyboard</item><item sku="MS-9" qty="2">Mouse</item><note><![CDATA[Leave at <reception> & ring]]></note></order>
Formatted, 2-space indent
<order id="A-17"> <customer>Ana Silva</customer> <item sku="KB-2" qty="1">Keyboard</item> <item sku="MS-9" qty="2">Mouse</item> <note><![CDATA[Leave at <reception> & ring]]></note> </order>
Each element is indented by its depth, and elements that hold only text stay on one line so the values are easy to scan. The CDATA section is copied exactly, including the < and & that would otherwise need escaping. Switching to To JSON gives an order object with "@id": "A-17" and an item array of two objects, each with @sku, @qty and #text, because the two item elements repeat under the same parent.
Paste XML to indent it, minify it or convert it to JSON as you type, with an instant well-formedness check that points to the exact line and column of any error. Browse the result as a collapsible tree or query it with XPath, all in your browser.
XML still runs a surprising amount of the world: RSS and Atom feeds, SVG images, Office documents, Android layouts, Maven and .NET config files, SOAP services and sitemaps. It often arrives on a single line or with inconsistent indentation. This formatter lays it out cleanly, tells you immediately whether it is well formed, and does so without changing what the document means.
Formatting that respects the document. Each element is indented by its nesting depth with 2 spaces, 4 spaces or tabs. Text content, attribute values and comments are kept exactly. CDATA sections are written back byte for byte, because whitespace inside them is data. Elements marked xml:space="preserve", and mixed content where text and elements sit side by side, are left as they are, since adding line breaks there would change the text a program reads. Minify removes the whitespace between elements under the same rules, so the minified file is the same document in fewer bytes.
Errors you can act on. Every change re-checks the document. If it is not well formed, you get the line and column, the offending line with a caret under the problem, and a suggestion such as which element is still open or which closing tag does not match. The tool also asks your browser's own XML parser, so a document that passes here will load in other software that reads standard XML.
Tree and XPath views. The Tree view lets you fold and unfold elements to find your way around a large file. The XPath view evaluates XPath 1.0 expressions and shows matching nodes with a path you can copy, or the number, string or true/false value an expression returns. When the document declares a default namespace, as SVG, Atom, RSS extensions and many config formats do, an unprefixed name like //book matches nothing in XPath 1.0. The tool gives the default namespace a prefix and shows you how to use it, which solves one of the most common XPath puzzles.
Converting to JSON. To JSON turns elements into objects, attributes into @-prefixed keys, text into #text when an element also has attributes, and repeated elements into arrays. JSON has no place for comments or processing instructions, so when the document contains them the tool lists what was left out rather than dropping it silently. Everything happens locally, so internal configuration and data files stay private.
Indent a single-line response from a log or network trace so you can find the element you need, then query it with XPath.
Find the unclosed tag in a web.config, pom.xml or Android layout from the exact line and column of the error.
Format an exported SVG to edit it by hand, or minify it before inlining it into a page.
Convert an XML export into JSON for a JavaScript app, and see whether any comments or processing instructions were left out.
<order id="A-17"><customer>Ana Silva</customer><item sku="KB-2" qty="1">Keyboard</item><item sku="MS-9" qty="2">Mouse</item>...</order> formats to six lines, one element per line, with the CDATA note kept exactly as written.
<order><item>Keyboard</order> is reported at line 1, column 22: </order> does not match the open <item>, with the hint that every element has to be closed in order.
For the bookstore example, which declares xmlns="http://example.com/bookstore", //book finds nothing, while //bookstore:book[bookstore:price > 12]/bookstore:title returns A Brief History of Time.
A well-formed XML document follows the basic syntax rules: exactly one root element, every element closed and properly nested, attribute values quoted, and special characters such as & and < escaped outside CDATA. Any XML parser can read a well-formed document. Validity against a DTD or XSD schema is a separate, stricter check that this tool does not perform.
No. Only whitespace between elements is added or removed. Text, attribute values, comments and CDATA sections are kept, and elements with xml:space="preserve" or mixed text and markup are left untouched because whitespace there is meaningful.
The most common reason is a default namespace. In XPath 1.0 an unprefixed name only matches elements in no namespace, so //item finds nothing in a document with xmlns="...". The XPath view assigns the default namespace a prefix and shows it, so write //prefix:item instead.
Attributes become keys starting with @, text inside an element that also has attributes becomes #text, and elements that repeat under the same parent become an array. Comments and processing instructions have no JSON equivalent, so they are listed under What JSON could not carry.
Yes. Choose Tab in the Indent menu next to Format. The choice is saved in the share link along with the output mode.
No. Parsing, formatting, conversion and XPath all run in your browser, so confidential configuration and data never leave your device.
Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.