type temp struct {
Afd int
Bee string
}func main(){ text:=temp{3123,"4234"} b._:=json.Marshal(text) var text2 temp err:=json.Unmarshal(b,&text2) fmt.Println(err,text2)} temp结构体内的Afd和Bee首字母一定大写,否则无法序列化和反序列化
时间: 2024-08-27 22:22:41
type temp struct {
Afd int
Bee string
}func main(){ text:=temp{3123,"4234"} b._:=json.Marshal(text) var text2 temp err:=json.Unmarshal(b,&text2) fmt.Println(err,text2)} temp结构体内的Afd和Bee首字母一定大写,否则无法序列化和反序列化