golang : Unmarshal: json: cannot unmarshal array into Go value of type main.MonitorServerInfo
golang控制台报错:golang : Unmarshal: json: cannot unmarshal array into Go value of type main.MonitorServerInfo造成原因:String类型数据传入的数据是array格式原代码:result := make(map[string]interface{})err := json.Unmarshal([]b
·
golang控制台报错:
golang : Unmarshal: json: cannot unmarshal array into Go value of type main.MonitorServerInfo
造成原因:String类型数据传入的数据是array格式(数组套数组)
原代码:
result := make(map[string]interface{})
err := json.Unmarshal([]byte(msg), &result)
改为:
result := make([]map[string]interface{}, 0)
err := json.Unmarshal([]byte(msg), &result)
更多推荐


所有评论(0)