How can I create nested lists in YAML? I want to get:
{\"Hello\": [\"as\", [\"http://\", [\"cat\"]]]}
Here\'s my YAML that doesn\'t work (
And the answer is:
URL:
Description: URL of the website
Value:
"Fn::Join":
- ""
- - "http://"
- "Fn::GetAtt":
- ElasticLoadBalancer
- DNSName
(see http://pyyaml.org/wiki/PyYAMLDocumentation#YAMLsyntax - "block sequences can be nested")
Try:
Hello:
["as",
["http://",
[cat]
]
]
Json output:
{
"Hello": [
"as",
[
"http://",
[
"cat"
]
]
]
}
start nested list from a new line. using this approach it is easy to figure out.
Read this and this articles. They have a lot of examples.
try like this:
YAML
Value:
"Fn::Join":
- ""
-
- "http://"
- "Fn::GetAtt":
- ElasticLoadBalancer
- DNSName
Equivalent JSON
{
"URL": {
"Description": "URL of the website",
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"ElasticLoadBalancer",
"DNSName"
]
}
]
]
}
}
}