gin
gin copied to clipboard
Get request, unable to get multidimensional array parameters
// trace info
type TraceInfo struct{
Id_ bson.ObjectId `form:"_id" json:"_id" bson:"_id"`
Search SearchInfo `form:"search" json:"search" bson:"search"`
}
// search
type SearchInfo struct{
Text string `form:"text" json:"text" bson:"text"`
ResultQty string `form:"result_qty" json:"result_qty" bson:"result_qty"`
}
func SaveJsData(c *gin.Context){
var traceInfo TraceInfo
err := c.ShouldBindQuery(&traceInfo);
if err != nil {
c.AbortWithStatusJSON(http.StatusOK, util.BuildFailResult(err.Error()))
return
}
}
when i access http://xxxx:3000/fec/trace?search[text]=dress&search[result_qty]=13
can not get this search param,empty:
"search": {
"text": "",
"result_qty": ""
}