I want to parse mentioned json.
{"foo": [{ "bar": 1, "baz": 2 },{ "bar": 4, "baz": 25 }], "more": "text"}
using below struct to unmarshal
type FooStruct struct {
Bar int `json:"bar"`
Baz int `json:"baz"`
}
type ResponseStruct struct {
More string `json:"more"`
Foo []FooStruct `json:"foo"`
}
var contentHtml ResponseStruct
err = json.Unmarshal(<byte_array>, &contentHtml)
fmt.Printf("%+v", contentHtml.FooStruct[0].Bar)