YAML的塊序列表示一系列節(jié)點。 每個項目都由一個前導 - 指示符表示。 請注意,YAML中的-指示符應與具有空格的節(jié)點分開。
塊序列的基本表示如下 -
block sequence:
··- one↓
- two : three↓
請觀察以下示例以更好地理解塊序列。
示例1
port: &ports
adapter: postgres
host: localhost
development:
database: myapp_development
<<: *ports
JSON格式的塊序列輸出如下 -
{
"port": {
"adapter": "postgres",
"host": "localhost"
},
"development": {
"database": "myapp_development",
"adapter": "postgres",
"host": "localhost"
}
}
更多建議: