Compare commits

..

No commits in common. "3faebb9145e3406f041803e138c2da11660ae155" and "e228983e7306a6e854379f42b49d6f1a37e66fb8" have entirely different histories.

14
map.go
View File

@ -8,11 +8,11 @@
package wrapper package wrapper
import ( import (
"bytes"
"encoding/json" "encoding/json"
"errors" "errors"
"git.zhangdeman.cn/zhangdeman/easymap" "git.zhangdeman.cn/zhangdeman/easymap"
"git.zhangdeman.cn/zhangdeman/serialize" "git.zhangdeman.cn/zhangdeman/serialize"
"github.com/tidwall/gjson"
"reflect" "reflect"
) )
@ -78,13 +78,11 @@ func EasyMapFromString(data string) Map {
// //
// Date : 16:12 2023/8/10 // Date : 16:12 2023/8/10
func EasyMapFromByte(data []byte) Map { func EasyMapFromByte(data []byte) Map {
res := easymap.NewNormal() var tmpMap map[interface{}]interface{}
jsonRes := gjson.Parse(string(data)) decoder := json.NewDecoder(bytes.NewReader(data))
jsonRes.ForEach(func(key, value gjson.Result) bool { decoder.UseNumber()
res.Set(key.Value(), value.Value()) _ = decoder.Decode(&tmpMap)
return true return EasyMap(tmpMap)
})
return res
} }
// Map ... // Map ...