我正在尝试在 golang 代码中从 API 解析 JSON。通过true
选项参数传递它提供不同的附加信息和false
不同的输出。
使用 Json to Go 转换以获得为此创建结构类型的帮助。但它为 json 示例提供了以下结构类型:
{
"result": {
"99c4d91acc2486955c98015fbbdf06239b983c9d93d5069c39d040702af88738": {
"size": 845,
"fee": 0.000144,
"time": 1547444481,
"height": 1183405,
"startingpriority": 89509.20245398773,
"currentpriority": 89509.20245398773,
"depends": []
},
"73f582cf419f8b1cd6a87f81e0e9a4e783add27c2be083361e8eb4a3bac0134e": {
"size": 1635,
"fee": 0.000312,
"time": 1547444435,
"height": 1183405,
"startingpriority": 341863.3540372671,
"currentpriority": 341863.3540372671,
"depends": []
}
},
"error": null,
"id": "curltest"
}
type AutoGenerated struct {
Result struct {
Nine9C4D91Acc2486955C98015Fbbdf06239B983C9D93D5069C39D040702Af88738 struct {
Size int `json:"size"`
Fee float64 `json:"fee"`
Time int `json:"time"`
Height int `json:"height"`
Startingpriority float64 `json:"startingpriority"`
Currentpriority float64 `json:"currentpriority"`
Depends []interface{} `json:"depends"`
}
}
撒科打诨
相关分类