Please see this playground: https://play.golang.org/p/FOMWqhjdneg As you can see I have a XML response which I want to unmarshal into a Product
struct. The XML has an "assetBlock"
which contains nested nodes and extract data to Product struct. Any help would be appreciated
You need to make a struct for AssetBlock
and all of the types below it, I've done it up to group
to show you what I mean:
https://play.golang.org/p/vj_CkneHuLd
type Product struct {
GlobalID string `xml:"globalId"`
Title string `xml:"title"`
ChunkID int `xml:"gpcChunkId"`
AssetBlock assetBlock `xml:"assetBlock"`
}
type assetBlock struct {
Images images `xml:"images"`
}
type images struct {
GroupList groupList `xml:"groupList"`
}
type groupList struct {
Groups []group `xml:"group"`
}
type group struct {
Usage string `xml:"usage"`
Size string `xml:"size"`
}