当前位置:网站首页>golang json returns null
golang json returns null
2022-08-01 17:34: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"
}
边栏推荐
猜你喜欢
LeetCode Week 303
How can become a good architect necessary skills: painting for all the people praise the system architecture diagram?What is the secret?Quick to open this article and have a look!.
[Dark Horse Morning Post] Hu Jun's endorsement of Wukong's financial management is suspected of fraud, which is suspected to involve 39 billion yuan; Fuling mustard responded that mustard ate toenails
MySql 怎么查出符合条件的最新的数据行?
2022年MySQL最新面试题
酷逼了 Pathetic Dog 第 304 场周赛
matlab 基于奇偶校验的LSB隐藏水印 三种改进
金仓数据库KingbaseES安全指南--6.3. Kerberos身份验证
深入分析类加载器
TCP million concurrent server optimization parameters
随机推荐
2022 Strong Net Cup CTF---Strong Net Pioneer ASR wp
ROS2支持技术:DDS简述
SQL函数 TO_CHAR(三)
C语言:表达式求值详解
SQL窗口函数
Financial products with high annualized returns
酷逼了 Pathetic Dog 第 304 场周赛
变量交换;复合赋值;增递减运算符
金仓数据库 KingbaseES V8.3 至 V8.6 迁移最佳实践(4. V8.3 到 V8.6 数据库移植实战)
GTK修改pixmap像素,提取pixmap像素RGB值
Complete knapsack problem to find the number of combinations and permutations
SQL函数 TO_CHAR(二)
matlab 基于奇偶校验的LSB隐藏水印 三种改进
Ali's official Redis development specification
助推科技强国高质量发展《科创超级训练营》系列活动正式拉开帷幕
2022年SQL大厂高频实战面试题(详细解析)
快速抽取resnet_v2_152中间的特征层
金仓数据库 OCCI迁移指南(2. 概述)
想做期货,农产品期货怎么炒?波动大么
Bugku-Misc-贝斯手