Simple example code generated directly with the Bee tool, default.go This file as follows, the other has not changed, the output has been "{}", this is why?
Package controllers
Import ("Github.com/astaxie/beego")
Type Maincontroller struct {
Beego. Controller
}
Type mystruct struct {
Name string Age string
}
Func (this *maincontroller) Get () {
MS: = mystruct{"Tom", "25"}
This. data["json"] = &ms
This. Servejson ()
}
Beginning to think that is not so write, want to see Beego implementation code, can go or unfamiliar, look at the headache, ransacked a circle, found Xie Mengjun API programming ppt, feel no problem, odd strange.
Asked the group, did not respond, I am not too shy to ask again, just get restfulwebservice, read first
Look at the code today, unexpectedly found that the name and age do not have an initial capitalization, forget the rules of Go!!!, solve