I'm trying to create yaml file from a map with yamlBuilder but it's not in the right context that I need it to be.
For example: Map mymap = [1: "a, b, c ,d", 2: "y, d, x"]
The yamlfile that I want to look like:
-Content:
-1:
-a
-b
-c
-d
-2:
-y
-d
-x
How the syntax of creation the yaml file should be? I've tried:
def yamlFile = new YamlBuilder()
yamlFile{
myMap
}
but this is not the same design as I need it to be.
Thanks
Ok, so with the map you dropped in the question, you can do:
Which prints
As you can see, your input map just has String values, not lists...
If you meant to give your input map as:
Then the above code prints out
Which is what you say you want...
If the original map was correct and you're being sent comma separated Strings to represent lists, then you'll need to munge them yourself into lists
Which again gives you