You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package tools
|
|
|
|
func Struct2Map(obj interface{}) map[string]interface{} {
|
|
bs, err := json.Marshal(obj)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// json字符转化为map
|
|
var data = make(map[string]interface{})
|
|
err = json.Unmarshal(bs, &data)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return data
|
|
}
|