【发布时间】:2021-09-21 23:39:49
【问题描述】:
我有以下 JSON 响应。将其解组为 Golang 结构的最佳方法是什么? JSON to Golang 自动生成的结构是说结构的命名属性应该是 20210712、20210711、20210710 等,但这不起作用,因为随着未来日期的变化,结构字段会有所不同。动态执行此操作的最佳方法是什么?
{
"data": {
"2021-07-12": {
"Neutral": 3,
"Positive": 4,
"Negative": 4
},
"2021-07-11": {
"Neutral": 0,
"Positive": 1,
"Negative": 4
},
"2021-07-10": {
"Neutral": 0,
"Positive": 0,
"Negative": 3
}
}
}
【问题讨论】:
标签: json go struct marshalling unmarshalling