When sending JSON with ServeJSON in Beego, is there a way to skip fields? I know one can skip field for ORM: http://beego.me/docs/mvc/model/models.md#ignore-field but that is just for skipping fields in the database model, it is not related to sending JSON.
Asked
Active
Viewed 525 times
1 Answers
2
You can use the struct tag "-".
It should looks like :
type MyStruct struct {
Id int `json:"id"`
Hidden string `json:"-"`
}
It also works for the orm definition.

Seraf
- 118
- 2
- 8
-
It works. I couldn't find it in the documentation. Thanks. – NaN Oct 06 '16 at 15:35