请求的json数据转为map
dataJson := c.Query("data") var dataMap map[string]interface{} dmErr := json.Unmarshal([]byte(dataJson), &dataMap) if dmErr != nil { panic("data error") }
golang 一行代码 把array/slice转成逗号分隔的字符串
strings.Replace(strings.Trim(fmt.Sprint(array_or_slice), "[]"), " ", ",", -1)
[a] -> a -> a
[a b c] -> a b c -> a,b,c
Go语言JSON数据相互转换:https://www.cnblogs.com/itbsl/p/10638223.html
Golang - 处理json:https://www.cnblogs.com/yanghongtao/p/10970395.html
go语言基础之map赋值、遍历、删除 、做函数参数:https://www.cnblogs.com/nulige/p/10245204.html