【发布时间】:2018-01-17 01:05:06
【问题描述】:
如何在 YAML 中定义map[string] 对象?
我有 JSON 对象
{
"name": "SampleStore",
"books": {
"sample1": {
"author": "test1",
"prize": "1221"
},
"sample2": {
"author": "test2",
"prize": "890"
}
}
}
我在 YAML 中将对象定义为:
Types:
store:
name:
type: String
books:
Items:
Referemce: book_details
book_details:
author:
type: String
prize:
type: String
但这是列表的语法,我想要书的地图。如何在 YAML 中定义这些类型的映射?
【问题讨论】:
-
您的 YAML 中没有序列(列表)。请指出您认为的序列。