yaml:为什么不创建子对象?

yaml: why isn't this creating a subobject?

http://nodeca.github.io/js-yaml/#yaml=cGFyZW50OgoJY2hpbGQxOiAiZmFsc2UiCgljaGlsZDI6IAoJCXN1YmNoaWxkOiAidHJ1ZSI=

我的 YAML,我希望 child2 有一个包含 subchild 的对象,但它在 child2.

之后创建了一个单独的同级字段
parent:
    child1: "false"
    child2: 
        subchild: "true"

我的 YAML 有什么问题?

我预计

{ parent: null, child1: 'false', child2: { subchild: 'true' } }

但是得到了

{ parent: null, child1: 'false', child2: null, subchild: 'true' }

使用不同的 YAML 解析器 - 您的 .yml 没问题

http://yaml-online-parser.appspot.com/

您正在使用制表符进行缩进,这是不允许的,并且会混淆在线解析器。 Without tabs 它看起来和预期的一样。