package main
import ( "encoding/json" "fmt" )
type Student struct {
 ID int 
Gender string 
Name string 
Sno string 
}
func main() { 
// var jsonStr = "{\"ID\":1,\"Gender\":\"男\",\"Name\":\"李四\",\"Sno\":\"s0001\"}" var jsonStr = `{"ID":1,"Gender":"男","Name":"李四","Sno":"s0001"}` 
//定义一个 Monster 实例 
var student Student 
err := json.Unmarshal([]byte(jsonStr), &student) 
if err != nil { 
fmt.Printf("unmarshal err=%v\n", err) 
}
fmt.Printf("反序列化后 student=%#v student.Name=%v \n", student, student.Name) }