beego controller响应json时如何忽略空值:如
```
{
"Id": 0,
"Account": "admin",
"Password": "",
"RoleId": 0,
"Status": "",
"CreateTime": "0001-01-01T00:00:00Z",
"CreateUserId": 0,
"UpdateTime": "0001-01-01T00:00:00Z",
"UpdateUserId": 0
}
```
零值数据不返回 只返回 `{“Account”:"admin"}`
代码:
```
func (this *AdminManageController) GetCurrentSysAdmin() {
var uid = this.GetSession("uid")
this.Ctx.Output.JSON(entity.SysAdmin{Account:uid.(string)}, true, false)
}
```
有疑问加站长微信联系(非本文作者)