tomap
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"math"
|
||||
"net/url"
|
||||
"reflect"
|
||||
@@ -43,6 +44,7 @@ func TryUnmarshalUseNumber(data []byte, result interface{}) error {
|
||||
|
||||
// 这个函数将解析json,返回的map中的字段类型与structObj中的完全一样的
|
||||
func Unmarshal2Map(data []byte, structObj interface{}) (resultMap map[string]interface{}, err error) {
|
||||
globals.SugarLogger.Debugf("进入Unmarshal2Map")
|
||||
if err = json.Unmarshal(data, structObj); err == nil {
|
||||
if err = json.Unmarshal(data, &resultMap); err == nil {
|
||||
m := Struct2MapByJson(structObj)
|
||||
@@ -55,6 +57,7 @@ func Unmarshal2Map(data []byte, structObj interface{}) (resultMap map[string]int
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("resultMap===========%v err=======%v", resultMap, err)
|
||||
return resultMap, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user