mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
20 lines
295 B
Go
20 lines
295 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gogf/gf/container/glist"
|
|
)
|
|
|
|
func main() {
|
|
b := []byte(`{"Id":1,"Name":"john","Scores":[100,99,98]}`)
|
|
type Student struct {
|
|
Id int
|
|
Name string
|
|
Scores *glist.List
|
|
}
|
|
s := Student{}
|
|
json.Unmarshal(b, &s)
|
|
fmt.Println(s)
|
|
}
|