当前位置:网站首页>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"
}
边栏推荐
猜你喜欢
随机推荐
数字化采购管理系统开发:精细化采购业务流程管理,赋能企业实现“阳光采购”
DevExpress的GridControl帮助类
金仓数据库KingbaseES安全指南--6.5. LDAP身份验证
我在启牛开户安全吗?谁能告诉我开不靠谱?
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!.
块级元素、行内元素、行内块元素
C#的路径帮助类
FTP helper class for C#
金仓数据库KingbaseES安全指南--6.3. Kerberos身份验证
Path helper class for C#
2022年深圳市临床医学研究中心申请指南
matlab 基于奇偶校验的LSB隐藏水印 三种改进
下载 | 谷歌科学家Kevin P. Murphy发布新书《概率机器学习:高级主题》
11 Publish a series as soon as it is released
阿里官方 Redis 开发规范
【二叉树】奇偶树
关于LocalDateTime的全局返回时间带“T“的时间格式处理
C# LibUsbDotNet 在USB-CDC设备的上位机应用
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!
深入分析类加载器









