go使用msgpack
// test project main.go package main import ( "fmt" "github.com/vmihailenco/msgpack" ) type ( Player struct { Id int Name string } ) func main() { var s [3]Player = [3]Player{ Player{1, "李白"}, Player{2, "赵四"}, Player{3, "小白"}} fmt.Println(s) b, _ := msgpack.Marshal(s) //序列 fmt.Println(b) var out []Player _ = msgpack.Unmarshal(b, &out) //还原 fmt.Println(out) }