【发布时间】:2015-07-25 03:01:23
【问题描述】:
基本上尝试在 yaml 中使用这个 json 来完成一些事情:
{
models:
[
{
model: "a"
type: "x"
#bunch of properties...
},
{
model: "b"
type: "y"
#bunch of properties...
}
]
}
到目前为止,这就是我所拥有的,它不起作用,因为我正在重复我的 model 键,但是通过保留 model 关键字可以做到这一点的正确方法是什么?
models:
model:
type: "x"
#bunch of properties...
model:
type: "y"
#bunch of properties...
【问题讨论】:
-
您是否尝试过将 JSON 代码加载到本机数据结构中(使用您选择的语言),然后使用 YAML 库来序列化该结构?让机器为您完成工作总是更容易。 :)