首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

【Golang报错】100% 解决 json: cannot unmarshal array into Go value of type model.xxx 问题

2023/03/06 20:54:40 [31;1m/xxxx/task.go:476 [35;1msql: Scan error on column index 3, name "xxx": json: cannot...unmarshal array into Go value of type model.xxxx [0m[33m[31.874ms] [34;1m[rows:1][0m SELECT * FROM...id" LIMIT 1 解决方案: 检查定义的类型是否有问题: type Results map[string]interface{} --》type Results []map[string]interface...原因: 在定义的 model 中,某一个字段的数据类型应该定义为: type Results map[string]interface{} 但其实数据库中存储的类型与此不符合。...现在要反序列化传给前端,所以应该改成如下: type Results []map[string]interface{} 号外号外:) 我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https:/

1.5K40
领券