Tay*_*tin 3 javascript markdown yaml
我目前有这个 JS 数组,我想将其转换为 YAML 文件。我尝试查找内容,我知道如何创建对象和数组,但不知道如何嵌套它们。
cartParams: [
{
title: Leg type,
options: [
Round,
Square
]
},
{
title: Leg width / diameter,
options: [
1.00 inches,
1.25 inches,
1.50 inches,
1.75 inches,
2.00 inches
]
}
]
Run Code Online (Sandbox Code Playgroud)
您的 YAML 文件可能如下所示:
cartParams:
- title: Leg type
options:
- Round
- Square
- title: Leg width / diameter
options:
- 1.00 inches
- 1.25 inches
- 1.50 inches
- 1.75 inches
- 2.00 inches
Run Code Online (Sandbox Code Playgroud)
顺便说一下,YAML 是 JSON 的超集,这意味着每个 JSON 对象也是一个有效的 YAML 对象。因此,您也可以使用对象的 JSON 表示。
有关使用 YAML 特定语法嵌套列表的更多信息,请查看此处:https : //stackoverflow.com/a/16335038/942648
归档时间: |
|
查看次数: |
8753 次 |
最近记录: |