当前位置:网站首页>golang json 返回空值
golang json 返回空值
2022-08-01 17:33:00 【dorlolo】
使用struct{}{}
返回空对象
func OkReply(c *app.RequestContext) {
c.JSON(200, CommonResult{
Data: struct{
}{
},
Code: ErrCode_None,
Message: "ok",
})
}
返回json
{
"data":{
},
"code":0,
"message":"ok"
}
使用make([]interface{}, 0)
返回空数组
func OkReply(c *app.RequestContext) {
c.JSON(200, CommonListResult{
List: make([]interface{
}, 0),
Code: ErrCode_None,
Message: "ok",
})
}
返回json
{
"data":[],
"code":0,
"message":"ok"
}
边栏推荐
猜你喜欢
matlab 基于奇偶校验的LSB隐藏水印 三种改进
基于ORB-SLAM2的改进代码
Vulnhub target drone: HARRYPOTTER_ NAGINI
[供应链·案例篇]石油和天然气行业的数字化转型用例
Xingtu has been short of disruptive products?Will this M38T from the Qingdao factory be a breakthrough?
02 es cluster construction
Detailed explanation of the working principle of crystal oscillator
The site is not found after the website is filed. You have not bound this domain name or IP to the corresponding site! The configuration file does not take effect!
成为优秀架构师必备技能:怎样才能画出让所有人赞不绝口的系统架构图?秘诀是什么?快来打开这篇文章看看吧!...
C语言:表达式求值详解
随机推荐
吴恩达机器学习课后习题——kmeans
04 flink 集群搭建
酷逼了 Pathetic Dog 第 304 场周赛
我的新书销量1万册了!
浅谈大数据背景下数据库安全保障体系
网上开户佣金万一靠谱吗,网上开户安全吗
C # Excel helper classes
C#的FTP帮助类
面经汇总-社招-6年
GRUB2的零日漏洞补丁现已推出
03 gp 集群搭建
Winform的UI帮助类——部分组件会使用到DevExpress组件
基于ORB-SLAM2的改进代码
金仓数据库 KDTS 迁移工具使用指南(3. 系统部署)
浅谈游戏音效测试点
存储日报-数据湖架构权威指南(使用 Iceberg 和 MinIO)
关于MySql中explain结果filtered的理解
GridControl helper class for DevExpress
素域和扩域
关系运算符和if,else语句