【发布时间】:2017-09-08 20:40:28
【问题描述】:
{
"meta": {
"type": "RESPONSE",
"application": "",
"data0": {
some data
},
"lv1": [
{
"status": "SUCCESS",
"response-type": "JSON",
"message": {},
"response": {
"more_data": "TRUE",
"no_result": "5",
"current_page": "1",
"data": [[
"1",
"2",
"3"]]
}
}
]
}
}
type response struct {
META struct {
LV []struct {
RESPONSE struct {
Data []struct {
array []struct {
val []string
}
} `json:"data"`
} `json:"response"`
} `json:"lv1"`
} `json:"meta"`
}
如何获取以下值?
"data": [[
"1",
"2",
"3"]]
我已经尝试过接口和结构。使用接口导致接口类型为[1 2 3],我不确定如何获取这些值。使用 struct 时,我在尝试使用错误消息映射数组数组时遇到了问题:
"无法将数组解组到 Go 结构字段 .data 类型为 struct { vals []字符串}"
【问题讨论】:
-
您发布的 JSON 在某处无效...
标签: go