struct_tool.go
278 字节
package utils
import (
"bytes"
"encoding/json"
)
func ObjectJsonToMap(obj interface{}) (v map[string]interface{}) {
var data bytes.Buffer
enc := json.NewEncoder(&data)
enc.Encode(obj)
decoder := json.NewDecoder(&data)
decoder.UseNumber()
decoder.Decode(&v)
return
}