Skip to main content

YAML Parsing Simulator

Edit YAML and watch what the parser actually decides your values are. The Norway problem where NO becomes the boolean false, version 1.10 becoming a lower number than 1.9, leading zeros meaning octal in one spec and decimal in another, empty against null against an empty string, block scalars, and tabs. Every document is read twice, under YAML 1.1 and YAML 1.2, so you can see exactly where the two specs disagree. The parser is real and runs in your browser.

Category: DevOps

What You Will Learn

  • Why `country: NO` becomes the boolean false, and which parsers do it
  • Why `version: 1.10` is a lower number than `version: 1.9`
  • How YAML 1.1 and YAML 1.2 disagree about the same file, and why that matters
  • The difference between an empty value, `~`, `null` and an empty string
  • When a leading zero means octal and when it means decimal
  • What `|` and `>` do to the newlines in a CI script
  • Why a repeated key silently overwrites the one above it
  • How anchors, aliases and merge keys work in a CI config
  • Why a tab in indentation is rejected and so hard to spot
  • Why quoting is the fix for nearly all of it

Topics covered: yaml, configuration, kubernetes, ci-cd, parsing, debugging, educational, interactive

// simulator

YAML Parsing Simulator

Edit YAML and watch what the parser actually decides your values are. The Norway problem where NO becomes the boolean false, version 1.10 becoming a lower number than 1.9, leading zeros meaning octal in one spec and decimal in another, empty against null against an empty string, block scalars, and tabs. Every document is read twice, under YAML 1.1 and YAML 1.2, so you can see exactly where the two specs disagree. The parser is real and runs in your browser.

Supported byBecome a sponsor
SvixAtomsizedDigitalOceanDevDojoSMTPfastQuizAPI

A country list, written the obvious way. Edit it and watch what changes.

YAML you wrote
What the parser seesYAML 1.2
countries:
  -
    name: "Norway"
    code: "NO"
  -
    name: "Sweden"
    code: "SE"
The same file, older parserYAML 1.1
countries:
  -
    name: "Norway"
    code: false
  -
    name: "Sweden"
    code: "SE"
Types resolved
Every value here stayed a string.
The two specs disagree about 1 value
whereyou wroteYAML 1.1YAML 1.2
countries[0].codeNObool falsestring
Under YAML 1.1, NO is the boolean false. Norway loses its country code. SE is untouched, so the bug only appears for one row and only in some parsers.

About this YAML parsing simulator

What you'll learn

  • That YAML resolves your untagged values into types, and which ones surprise people
  • That YAML 1.1 and YAML 1.2 disagree, so the same file means different things in different tools
  • Why the failures are quiet: nothing errors, a value just stops being what you meant
  • The two-character fix, and when you actually need it

How it works

  • The parser is real and runs in your browser. Nothing here is a canned answer.
  • Every document is read twice, once under each spec, and the differences are listed.
  • Edit any example. Your own YAML is resolved by the same rules.

The behaviour shown here follows the YAML 1.2.2 specification and the older YAML 1.1 boolean type, which is the one that turns Norway into false. Most tools still ship a 1.1-era resolver: that is not a bug in your file, it is a disagreement between versions of the format.

Related: the Kubernetes terminal simulator for the manifests this bites hardest, and the Git concepts simulator for the other thing everyone learns by breaking it.

Try next

Sponsored
Carbon Ads
$ cd /games
// share