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)
golang : Unmarshal: json: cannot unmarshal array into Go value of type main.MonitorServerInfo
于 2022-01-13 17:07:08 首次发布