gin框架如何接口post请求中 不同类型的json参数
比如传{"id":"1"}
我的struct是
type IdReq struct {
Id int `json:"id"`
}
使用 **ShouldBindJSON** **Bind** **BindJSON**
或者映射到**map[string]interface{}**中 再进行**json.Marshal** **json.Unmarshal** 都会报类型的错误
**json: cannot unmarshal string into Go struct field testat.age of type int**
有什么办法能无感映射到struct中?