1 回答

TA貢獻1934條經驗 獲得超2個贊
for _, v := range data { // we need value part of the map
m, ok := v.(map[string]interface{}) // we need the convert the map
// into interface for iteration
if !ok {
fmt.Printf("Error %T", v)
}
for k, l := range m {
if k == "ATA_ESKI"{ // the value we want is inside of this map
a, ok := l.(map[string]interface{}) // interface convert again
if !ok {
fmt.Printf("Error %T", v)
}
for b,c := range a{
if b == "satis"{ // the value we want
fmt.Println("Price is", c)
}
}
}
}
}
我們可以在最后的“返回數據,零”之前獲得添加此迭代的值,但我認為必須有更簡單的方法。
- 1 回答
- 0 關注
- 105 瀏覽
添加回答
舉報