json([]byte) 和 struct 互转
json 转 struct
json.Unmarshal(json, struct)
eg:
info := models.Info{}
data := c.Ctx.Input.RequestBody
parseErr := json.Unmarshal(data, &info)
struct 转 json([]byte)
json.Marshal(struct)
eg:
jsonStr,parseErr := json.Marshal(struct)
interface{} 转 struct
interface{}.(struct)
eg:
date := i.(Entry)