-->

YAML: dictionary with empty value

2020-08-09 05:10发布

问题:

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

回答1:

key:

is parsed as null -

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

The correct answer is:

key: ""