flybywire
flybywire

Reputation: 273922

YAML: dictionary with empty value

How do I write in YAML a dictionary (map) where one key has the empty string as its value?

Upvotes: 60

Views: 37503

Answers (1)

Andrey
Andrey

Reputation: 3001

key:

is parsed as null -

%YAML 1.1
---
!!map {
    ? !!str "key"
    : !!null "null",
}

The correct answer is:

key: ""

Upvotes: 80

Related Questions