About the YAML Validator
YAML is strict about indentation and surprisingly loose about everything else, which is why a file can look fine and still fail to load. This validator parses the input with js-yaml (YAML 1.2) and, on failure, shows the line and column, quotes the line with a caret under the position, and explains the parser's message: bad indentation of a mapping entry usually means that a key is not aligned with its siblings or that a value containing : needs quotes. Documents separated by --- are all checked, and the parsed result is shown as JSON so that you can see what your application will receive.
Valid YAML can still be wrong. Duplicate keys are forbidden by the specification, but PyYAML and Ruby silently keep the last value while strict parsers reject the file; every duplicate is listed with both line numbers. Tabs are not allowed for indentation. And plain scalars are typed by their look: 1.10 becomes the number 1.1, 0644 is 644 in YAML 1.2 but octal 420 in YAML 1.1, and no, yes, on and off are strings in YAML 1.2 but booleans for YAML 1.1 parsers — the reason the country code of Norway famously turned into false. The validator points these out so that you can quote them.
The check covers syntax and these pitfalls, not the meaning of the keys: whether replicas is a valid field of a Kubernetes manifest is a question for a schema. Application-specific tags such as CloudFormation's !Ref are reported as unknown tags, because a generic parser cannot construct them. Everything runs in your browser, so configuration files with internal host names or credentials do not leave your machine.
How to use it
- Paste your YAML or open a .yml / .yaml file.
- Read the result above the editors: green means the document parses.
- If it is invalid, go to the reported line and column; the caret marks the position and the message explains the cause.
- Review the warnings about duplicate keys, tabs and ambiguous values, and quote what should stay text.
- Check the JSON output to see the values and types that a parser produces.
Frequently asked questions
Why is the error reported on a different line than my mistake?
Is <code>no</code> a boolean or a string?
true and false are booleans, so no is a string. YAML 1.1 parsers such as PyYAML and Ruby's Psych read yes, no, on and off as booleans. Quote the value to get a string everywhere.