我有以下 YAML 我正在尝试用 SPYC 解析(https://github.com/mustangostang/spyc/):
children:
- root:
- child one
- child two:
- subchild one
- subchild two
- child three
我希望它返回如下内容:
["children"]=>array(1){
["root"]=>array(3){
[0]=>string(9) "child one",
["child two"]=>array(2){
[0]=>string(12) "subchild one"
[1]=>string(12) "subchild two"
}
[1]=>string(11) "child three"
}
}
相反,它返回类似这样的内容(包含似乎是一堆空且不必要的数组):
array(4) {
[0]=>
array(4) {
["root"]=>
array(0) {
}
[0]=>
string(9) "child one"
[1]=>
array(3) {
["child two"]=>
array(0) {
}
[0]=>
string(12) "subchild one"
[1]=>
string(12) "subchild two"
}
[2]=>
string(11) "child three"
}
我构建 YAML 内容的方式是否有问题,或者 SPYC(解析器)是否存在已知问题?
谢谢!