所以我一直试图填充我创建的结构的这个怪物,但没有成功。
type Initial_Load struct {
Chapters []struct {
Name string `Chapter Name`
PageNum int `Number of Page"`
Pages []struct {
Description string `Page Description`
PageNumber int `Page Number`
Source string `Page Source`
}
}
NumChapters int `Total number of chapters`
}
这是该结构正在建模的 JSON
{
"Num_Chapters": 2,
"Chapters": [
{
"Name": "Pilot",
"Page_Num": 2,
"Pages": [
{
"Page_Number": 1,
"Source": "local.com",
"Description": "First Page"
},
{
"Page_Number": 2,
"Source": "local.com",
"Description": "Second Page"
}
]
},
{
"Name": "Chapter2",
"Page_Num": 2,
"Pages": [
{
"Page_Number": 1,
"Source": "local.com",
"Description": "First Page"
},
{
"Page_Number": 2,
"Source": "local.com",
"Description": "Second Page"
}
]
},
{
"Name": "Chapter3",
"Page_Num": 2,
"Pages": [
{
"Page_Number": 1,
"Source": "local.com",
"Description": "First Page"
},
{
"Page_Number": 2,
"Source": "local.com",
"Description": "Second Page"
}
]
}
]
}
有关于填充嵌套结构的已回答问题,但我还没有找到包含结构数组的问题。我知道这可能很简单,但我就是想不通。谢谢。
慕神8447489
相关分类