mirror of
https://gitee.com/johng/gf
synced 2026-06-26 17:35:40 +08:00
23 lines
338 B
Go
23 lines
338 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gogf/gf/container/garray"
|
|
)
|
|
|
|
func main() {
|
|
type Student struct {
|
|
Id int
|
|
Name string
|
|
Scores *garray.IntArray
|
|
}
|
|
s := Student{
|
|
Id: 1,
|
|
Name: "john",
|
|
Scores: garray.NewIntArrayFrom([]int{100, 99, 98}),
|
|
}
|
|
b, _ := json.Marshal(s)
|
|
fmt.Println(string(b))
|
|
}
|