TOOLTIKI Lovable tool, really free
Developer Data

YAML formatter

What to do

Anchors, aliases and multiple documents are refused rather than half-read.

Processed in your browser · nothing is uploaded

Local · refuses anchors rather than half-reading them
Advertisement
320 × 100

Reindents YAML to two spaces per level and reports the line where it stops making sense. It also converts to and from JSON, since the two describe the same thing.

How to use the yaml formatter

1 Paste your input. The result appears immediately.
2 Pick the operation you want.
3 Copy the result, or save it as a file.

YAML is whitespace-significant, so a formatter cannot separate style from meaning the way a JSON formatter can: changing indentation changes the document. What happens here is a parse and a re-emit, which normalises indentation and quoting and, more usefully, fails loudly on input that does not parse — with the line rather than a shrug. The classic YAML surprise is unquoted values. `no` is boolean false in YAML 1.1, which is why country code `NO` for Norway becomes `false`, and why version `1.10` becomes the number 1.1. Quoting fixes both, and if a value is meant as a string it should be quoted regardless of whether it currently works. Anchors, aliases and multi-document files are refused here rather than half-supported. A formatter that silently expands an anchor changes the document; one that drops it destroys information. Refusing is the only honest option for the subset this handles, and the page says so rather than failing mysteriously.

Questions

YAML 1.1 reads no, yes, on and off as booleans. Quote the value: "NO".

YAML 1.2 specificationThe Norway problem — YAML boolean coercion
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING