XML format / minify / validate / to JSON
xml_formatValidate, pretty-print, minify, or convert XML to JSON, with line/column errors and optional comment removal; accepts inline text or a file path.
Instructions
Validate XML (well-formedness and namespaces, with line and column for errors), pretty-print it (2, 4 spaces or tab; mixed content, CDATA and xml:space="preserve" kept exactly as written), minify it, or convert it to JSON (attributes as "@name", repeated elements as arrays, text as "#text"). Optionally removes comments. Never loads external DTDs or entities. Give "text" or a file "path". Web version: https://s3eidat.github.io/xml-format/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "format" pretty-prints, "minify" strips layout whitespace, "json" converts to JSON, "validate" only checks (never throws on bad XML). | format |
| path | No | Or: a path to a XML file (UTF-8; use this for big inputs). | |
| text | No | The XML as inline text. | |
| indent | No | Indentation: 2, 4, "tab" (or any number of spaces 0-8). | 2 |
| output | No | Optional: also write the result to this file path (or folder ending in "/"). The result text is then left out of the reply. Results over 1,000,000 characters are always written to a file. | |
| removeComments | No | Drop <!-- comments --> (format and minify). |