赞
踩
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)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。