YAML Validator: Catch Indentation Errors Before They Break Your Pipeline
YAML is notoriously easy to break silently — an extra space reparents a key, a missing colon produces a scalar instead of a mapping, indentation mixing causes a parse error that only surfaces at runtime. This validator checks your YAML for indentation consistency and unclosed quotes, then shows the parsed structure as JSON so you can verify the YAML means what you think it does.
One wrong space makes 'city' a top-level key instead of nested under 'address'. The JSON preview makes this immediately visible.
The Silent Reparenting Problem
YAML's indentation-based structure means that a key indented one space too many or too few silently changes structure. Most YAML parsers don't error on this — they just produce a different parse tree. This is particularly dangerous in Kubernetes manifests, GitHub Actions workflows, and Docker Compose files where a misplaced key disables a feature without an error message.
Using the JSON Preview to Verify Intent
The JSON preview is the most valuable part of this validator. After pasting your YAML, compare the JSON to what you intended: (1) Are all nested keys correctly indented? (2) Are sequences (arrays) at the right level? (3) Do boolean/number values parse to the right type? If the JSON shows a key at the wrong level, find the line in the YAML and adjust its indentation.
Common YAML Mistakes
Tabs mixed with spaces (YAML 1.2 forbids tabs for indentation). An extra colon after a key: value pair. Forgetting a space after the colon (key:value is a string, not a mapping). Bare values that look like numbers (port: 8080 is fine, but password: 0800123456 may parse as an integer). Missing quotes around values with special characters (: { } [ ] , # & * ? | - < > = ! % @ \).
What Gets Validated
- Indentation consistency (spaces vs tabs)
- Mixed tabs-and-spaces detection
- Unclosed quote characters
- Parse attempt with JSON output
- Statistics: total keys, arrays, max nesting depth
Frequently Asked Questions
What does the validator check?
Indentation consistency: checks that all indentation uses either spaces or tabs, not a mix, and that tabs and spaces are not mixed across lines. Unclosed quotes: detects a line ending with an odd number of unmatched quote characters. Parse attempt: tries to parse the YAML and shows the resulting structure as JSON, which you can use to verify the YAML means what you intend.
Why is indentation so important in YAML?
YAML uses indentation to define structure. A key-value pair that is indented one space too many or too few becomes a child of the wrong parent. For example, forgetting to indent a key under a mapping makes it a top-level key rather than a nested property — silently changing the document's meaning. YAML validation catches these structural indentation inconsistencies early.
What does the 'Parsed Structure (JSON)' section show?
The parsed JSON shows what the YAML actually means when interpreted. This is the ground truth for whether your YAML is correct. Compare the parsed JSON to what you intended: are all keys nested correctly? Do arrays have the right items? Are values the right types (string vs number vs boolean)? If the JSON looks wrong, the YAML has a structural problem.
What YAML features are not supported?
Anchors (&anchor) and aliases (*alias), merge keys (<<), custom YAML tags (!type), multi-document streams (---), and the Norway problem: this validator uses YAML 1.1 semantics where yes/no/on/off are booleans. Complex flow scalars and block scalars (| and >) are partially supported.