How to represent a (key,value) tree structure in YAML?
I would like to represent tree structures in YAML. Each node of the tree is composed of a (key,value) pair. The key must be a string. A structure like this would be perfect: node1: child_A: child_AA: child_AB: 1.2 child_B: node2: ...except that I sometimes have nodes that have values but are not leaves. For example, let's add a child to child_AB: node1: child_A: child_AA: child_AB: 1.2 child_ABA: 3.14 child_B: node2: This is not valid YAML anymore! Is there a nice way to correct the last YAML document to make it work while staying true to this (key,value) tree structure? This one is correct : node1: child_A: child_AA: child_AB: : 1.2 # using empty string, could also use 'value' or similar child_ABA: 3.14 child_B: node2: But I feel it's a shame that something like the previous one is not valid. Any suggestion? YAML extensions? Alternatives languages?
I would like to represent tree structures in YAML. Each node of the tree is composed of a (key,value) pair. The key must be a string.
A structure like this would be perfect:
node1:
child_A:
child_AA:
child_AB: 1.2
child_B:
node2:
...except that I sometimes have nodes that have values but are not leaves. For example, let's add a child to child_AB
:
node1:
child_A:
child_AA:
child_AB: 1.2
child_ABA: 3.14
child_B:
node2:
This is not valid YAML anymore!
Is there a nice way to correct the last YAML document to make it work while staying true to this (key,value) tree structure?
This one is correct :
node1:
child_A:
child_AA:
child_AB:
: 1.2 # using empty string, could also use 'value' or similar
child_ABA: 3.14
child_B:
node2:
But I feel it's a shame that something like the previous one is not valid. Any suggestion? YAML extensions? Alternatives languages?