Yaml syntax to create this array -
given following simple yaml data,
foo: 1 bar: - 1 - 2
if want create array of exact same data structure, what's correct way?
i've tried
first: foo: 1 bar: - 1 - 2 - 3 second: foo: 2 bar: - one1 - two2 - three3
or,
- foo: 1 bar: - 1 - 2 - 3 - foo: 2 bar: - one1 - two2 - three3
and also,
- first: foo: 1 bar: - 1 - 2 - 3 - second: foo: 2 bar: - one1 - two2 - three3
but none seems correct way. help? thanks!
i think you're after either this:
- foo: 1 bar: - 1 - 2 - 3 - foo: 2 bar: - one1 - two2 - three3
which gives structure:
[ { "foo": 1, "bar": [ "one", "two", "three" ] }, { "foo": 2, "bar": [ "one1", "two2", "three3" ] } ]
or if 'first' , 'second' labels important you:
first: foo: 1 bar: - 1 - 2 - 3 second: foo: 2 bar: - one1 - two2 - three3
which gives dictionary/associative array:
{ "second": { "foo": 2, "bar": [ "one1", "two2", "three3" ] }, "first": { "foo": 1, "bar": [ "one", "two", "three" ] } }
Comments
Post a Comment