config icon indicating copy to clipboard operation
config copied to clipboard

Nested lists

Open PlkMarudny opened this issue 8 years ago • 1 comments

Hi,

What about such a YAML config:

part1:
- level1:
 - level2:
   -level3:
       key1: value1
       key2: value2

How to get deeper nested lists? cfg.List("part1.0.0.)

does not seem to work.

PlkMarudny avatar Dec 26 '17 12:12 PlkMarudny

Not an issue, nested lists do work correctly. Given that the missing spaces are added, you have nested lists of single-key maps: {"part1":[{"level1":[{"level2":[{"level3":{"key1":"value1","key2":"value2"}}]}]}]}.

    cfg, err := config.ParseYaml("bar: [[[foo]]]")
    fmt.Println(err, cfg.UList("bar.0.0"))

gives <nil> [foo]

orymate avatar Sep 10 '18 12:09 orymate