Empty field in yaml
You can use ~
or null
.
You should read documentation of YAML and you can read Symfony Yaml Format as well
title:
1: String
2: String2
3: ~
If you want an empty string, rather than a null value, you can use two single quotes.
title:
1: String
2: String2
3: ''
According to YAML v1.2 spec:
10.3.2. Tag Resolution
Regular expression Resolved to tag null | Null | NULL | ~ tag:yaml.org,2002:null /* Empty */ tag:yaml.org,2002:null
So putting null
or ~
or omitting value produces the same result: tag:yaml.org,2002:null
:
parent:
key1: # empty so "null", # is a comment!
key2: ~ # also "null"
key3: null # "null" explicitly ))
key4: !!null "null" # for the funs of "secondary tag handle: !!"
key5: "null" # sorry, it is a string or !!str if you like ((