Use this when YAML values are misinterpreted.
Scalars
YAML scalars are single values — strings, numbers, booleans, null. Quote strings like "yes", "no", "on" or version numbers such as "1.10", which YAML may otherwise turn into booleans or floats.
1. Scalars: strings, numbers, booleans, null, dates.
2. YAML 1.1 parsers treat yes/no/on/off as booleans.
3. Leading zeros may be octal.
4. Quote when in doubt.
5. Multi-line with | or >.
scalar text → resolved type
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as encoding/BOM issues, delimiter/quoting ambiguity, duplicate keys, namespace drift, scalar coercion, invalid schema assumptions and parser success without consumer-valid semantics, choosing the cases most relevant to plain/single/double quoted scalar forms, tags/types, null/boolean/number ambiguity and preserving intended strings through parser/consumer layers.
Step 2 Common mistakes Narrow the fault
- Unquoted
no,on,yesbecoming booleans in YAML 1.1 parsers. - Leading zeros (
0755) parsed as octal.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Unquoted yes, no and on may become booleans.
- 1.10 may become the number 1.1.
- Quote strings that look like other types.
yq '.value | tag' file.yaml— resolved type (!!str, !!int, !!bool)- Quote strings like 'no', 'on', '012' — avoid implicit typing
yamllint file.yaml— truthy rule
ReferenceWhy it matters1 section · depth on demand
What it is
YAML scalars are strings, numbers, booleans and null; quoting controls the type.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Scalars are single values in YAML: strings, numbers, booleans, null, dates. YAML guesses the type from how a value looks, which is convenient and a common source of bugs.
| Written | YAML 1.1 parsers (e.g. PyYAML) read it as |
|---|---|
yes, no, on, off | Booleans |
010 | Octal 8 |
1.10 | Float 1.1 |
22:22 | Sexagesimal number 1342 |
~ or empty | null |
2026-11-05 | Date |
Quote values that must stay strings: versions ("1.10"), country codes ("NO"), MAC-like or time-like values, and leading zeros. Multi-line strings use | (keep line breaks — good for certificates and CLI blocks) or > (fold into one line).
Mechanics
The linked authority for bounded mechanics is YAML 1.2.2 Specification; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in YAML > Scalars. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://yaml.org/spec/1.2.2/ · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For plain/single/double quoted scalar forms, tags/types, null/boolean/number ambiguity and preserving intended strings through parser/consumer layers, prefer typed fields and stable IDs over human presentation text.