mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 03:38:35 +08:00
20 lines
285 B
Go
20 lines
285 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gogf/gf/frame/g"
|
|
)
|
|
|
|
func main() {
|
|
b := []byte(`{"Id":1,"Name":"john","Scores":[100,99,98]}`)
|
|
type Student struct {
|
|
Id *g.Var
|
|
Name *g.Var
|
|
Scores *g.Var
|
|
}
|
|
s := Student{}
|
|
json.Unmarshal(b, &s)
|
|
fmt.Println(s)
|
|
}
|