Answer the question
In order to leave comments, you need to log in
How to parse an array of arrays of structures in Golang?
I have a structure like this:
type PhotoFaceResp struct {
Traits map[string][]string `json:"traits"`
Probability float32 `json:"probability"`
}
coreResp := make([][]PhotoFaceResp, 0, 0)
err := json.Unmarshal(body, &coreResp)
if err != nil {
panic(err)
}
for face := range coreResp{
// Тут face - int, а не []coreResp
}
Answer the question
In order to leave comments, you need to log in
Do it right like this:
for _, face := range coreResp{
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question