定义一个想获取的结构体 匹配好JSON字段名

type TestInfo struct {
	Id     int64      `json:"id"`
	Name   string     `json:"name"`
	Sex    string     `json:"sex"`
}

利用JSON的函数匹配为结构体数组

Test := []*TestInfo {}
	tsetString := this.InputString("test", ``, true, "test")//获取前端的数据 
	if tsetString != "" {
		json.Unmarshal([]byte(tsetString ), &Test )		
	}

用到的包

import (
	"encoding/json"
)