I'd like to represent a hierarchy in yaml, and I'm not sure how. For example, I'd like to say something like this:
name: "user1"
programming-skill: 3
java: 2
python: 2
cooking-skill: 4
When I throw this at a yaml parser, I get an error along the lines of "mapping values not allowed here" on the line java: 2
because I'm trying to assign programming-skill
to both 3
and the list {java: 2, python: 2}
.
What's the cleanest way to represent this hierarchical structure in yaml? Alternatively, is there a serialization format more suited than yaml to hierarchical structures?
name: "user1"
programming-skill:
- 3
- java: 2
python: 2
cooking-skill: 4
or if you prefer:
name: "user1"
programming-skill:
- 3
-
java: 2
python: 2
cooking-skill: 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With