So I've been trying to populate this monster of a struct I created, but with no success.
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`
}
Here's the JSON that this struct is modeling
{
"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"
}
]
}
]
}
There's of answered questions about populating nested structs, but I haven't found one which contains an array of structs. I know this is probably very simple, but I just can't figure it out. Thanks.