Search code examples
yamlyaml-cpp

is this valid yaml?


items:
    house:
        - bathroom:
            - toothbrush
            - soap
        - bedroom:
            - bed:
                - pillow
                - sheet
            - closet:
                - clothes:
                    - underwear
                    - socks
    garden:
        - treehouse:
            - toys:
                - nerfgun
                - car
            - window

        - garage:
            - car
            - toolbox:
                - hammer
                - scewdriver
                - pliers
            - lawnmower

Here is another try at this document, it has no compound list (I guess that's how it's called).

items2:
    house:
        - bathroom:
            - toothbrush
            - soap
        - bedroom:
            - bed:
                - pillow
                - sheet
            - closet:
                - clothes:
                    - underwear
                    - socks

Which of those two yaml documents are valid ? I'm still wondering if I can use a list of keyed lists like that (nested list ?):

items:
    - list1:
        -itemA
        -itemB
    - list2:
        -itemC
        -itemD

Solution

  • You can use this to check if your yaml is ok: yamlint

    It's seems ok.