mirror of
https://gitee.com/johng/gf
synced 2026-06-28 10:16:09 +08:00
24 lines
355 B
Go
24 lines
355 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gogf/gf/container/glist"
|
|
"github.com/gogf/gf/frame/g"
|
|
)
|
|
|
|
func main() {
|
|
type Student struct {
|
|
Id int
|
|
Name string
|
|
Scores *glist.List
|
|
}
|
|
s := Student{
|
|
Id: 1,
|
|
Name: "john",
|
|
Scores: glist.NewFrom(g.Slice{100, 99, 98}),
|
|
}
|
|
b, _ := json.Marshal(s)
|
|
fmt.Println(string(b))
|
|
}
|