Reputation: 2495
There are 2 variants of list to mapping in yaml:
-
name: Mark McGwire
hr: 65
avg: 0.278
and
- name: Mark McGwire
hr: 65
avg: 0.278
How do define this difference for serialization?
Upvotes: 0
Views: 118
Reputation: 39738
The YAML spec calls the second form compact notation. There is no semantic difference. An implementation is not required to let you choose between the two representations.
The only implementation I know of that lets you choose between these representations is ruamel via yaml.compact()
, see here.
Upvotes: 1