Skip to content
Changelog
new tooltext-data

YAML Formatter

v1.0

YAML Formatter reformats a YAML document and converts between YAML and JSON. Paste or drop in your YAML and choose an indent of 2 or 4 spaces, a line-wrap width (0 turns wrapping off), and an optional alphabetical key sort.

Comments, anchors, aliases and merge keys (<<: *anchor) all survive formatting, and sorted keys keep their comments attached. Because a section-header comment can stop making sense once its key moves, the tool names the commented keys a sort would reorder and warns you before you rely on it. Multi-document files separated by --- are handled one document at a time, and several documents convert to a JSON array.

Validation runs as you type with line and column numbers. Duplicate keys show a warning rather than an error, and values like no, yes, on and off stay as strings instead of turning into booleans.

The swap control flips the tool to convert JSON into YAML, carrying the previous output across so a YAML to JSON to YAML round trip stays in one place. After converting, Work with this as JSON opens JSON Formatter and Query it with JSONPath opens JSONPath Explorer, with your converted output already loaded.

Your indent and line-width choices are remembered on this device, and Share puts the input and options in a link.

All changes