Search code examples
javascriptyamlcodemirror

yaml: why isn't this creating a subobject?


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

my YAML, I expect child2 with an object containing subchild but it created a separate sibling field following child2.

parent:
    child1: "false"
    child2: 
        subchild: "true"

what is wrong with my YAML?

I expected

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

but got

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

Solution

  • You are using tabs for indentation and that is not allowed, and confuses that online parser. Without tabs it looks the same and works as expected.