这种写法是什么意思

cups_book · · 1232 次点击
``` type User struct { Name string "name"//结构的字段可以带标签字面量,成为字段的属性 Pass string "pass" Age int16 "age" } var json_string = `{"name":"zhangsan","pass":"123456","age":20}` var usr = new(User) json.Unmarshal([]byte(json_string), usr)//解析json字符串 fmt.Println(usr) Out: &{zhangsan 123456 20} ```
#4
更多评论
go结构体标签 https://blog.csdn.net/benben_2015/article/details/79807792
#1
嗯,我遇到的是这个错误: json: cannot unmarshal array into Go struct field 意思是说...go没法反序列化一个array到go的结构体字段里去..?
#2