1
在python中,您可以获取json对象并从中获取特定的项目,而无需声明结构,保存到结构中,然后像Go中那样获取值。 Go有没有包装或更简单的方法来存储json的特定值?Golang Json单值解析
蟒蛇
res = res.json()
return res['results'][0]
转到
type Quotes struct {
AskPrice string `json:"ask_price"`
}
quote := new(Quotes)
errJson := json.Unmarshal(content, "e)
if errJson != nil {
return "nil", fmt.Errorf("cannot read json body: %v", errJson)
}