GoLnand这门语言比较特殊,靠标志符的大小写来决定访问域,而不是像传统java,c++那样使用关键字限定访问。
看个例子:
这里定义了一个解析结构体
typeResponsestruct{
codeint64
msgstring
datastring
}
执行json解析
funcmain(){
varrespResponse
err:=json.Unmarshal([]byte(`{"code":200,"msg":"success","data":"MacbookPro2018款"}`),&a