Skip to content
toolsdocks

Format and validate YAML or XML

Paste a YAML or XML document to check it, format it, or convert it to and from JSON.

Runs on your device
Loading tool…

How to use

  1. Choose YAML or XML and paste your document.
  2. Format, minify, or convert to JSON.

Worked example

A YAML file indented with a tab reports “tab characters must not be used in indentation” at the exact line.

Supported formats and limits

InputYAML, XML
OutputYAML, XML, JSON
Enginejs-yaml (YAML 1.2) and fast-xml-parser with validator

Limitations

  • XML is checked for well-formedness, not against a DTD or XSD.
  • Minify is available for XML only. Converting to JSON drops comments, and several YAML documents become one JSON array.

Questions

What does the validation check?

YAML is parsed as YAML 1.2 (core schema with << merge keys), so errors such as a tab in the indentation are reported at their line. XML is checked for well-formedness: one root element, closed tags, defined entities and valid attribute values. It does not validate against a DTD or XSD.

Are YAML comments kept when formatting?

Yes. Formatting uses Prettier's YAML printer, which keeps comments and key order. Converting to JSON cannot keep comments.

How are XML attributes shown in JSON?

Attributes become keys prefixed with @_ and element text is stored under #text, and the same convention is used to build XML from JSON.

Privacy

Runs on your device. Files and text are processed in this browser tab and are not uploaded.

See the privacy policy for how toolsdocks handles data.