🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 实例代码 ~~~ package controllers import ( "github.com/astaxie/beego" ) type MainController struct { beego.Controller } type User struct { Id int `json:"id"` Name string `json:"name"` Age int `json:"age"` Title string `json:"title"` Desc string `json:"desc"` } type Jsons struct { Code int `json:"code"` Message string `json:"message"` List interface{} `json:"list"` } func (c *MainController) Get() { user := []User{ { 1, "Name1", 18, "title", "desc", }, { 2, "Name2", 18, "title2", "desc2", }, { 3, "Name3", 18, "title3", "desc3", }, { 4, "Name4", 18, "title4", "desc4", }, } json := Jsons{200, "获取成功", user} c.Data["json"] = json c.ServeJSON() } ~~~