Compare commits

..

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

14
map.go
View File

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