优化json解析
This commit is contained in:
parent
54ad5d7873
commit
eb2302301f
2
go.sum
2
go.sum
@ -1,5 +1,3 @@
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20220626081130-cbac0b676fb8 h1:HTa2y2Fsh9q48f29I/V2LhVQ5Pai55ULP1Qj3qwhrOE=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20220626081130-cbac0b676fb8/go.mod h1:G2/OKMbEn89d+YUXQtv9Nlh0LGg14pOqDnbOgBTTRXY=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20220702052429-b5ae4cf80989 h1:2yuM4QDfQ2UjzxNdtCY7CpOxclp31BqWQg09mB1ydfk=
|
||||
git.zhangdeman.cn/zhangdeman/util v0.0.0-20220702052429-b5ae4cf80989/go.mod h1:aQsgOqtMnnwG2n7T/0a1OkYigqBzZivv8Ea6683bK2M=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
|
@ -9,11 +9,11 @@ package rpc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/util"
|
||||
"github.com/tidwall/gjson"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
@ -64,9 +64,7 @@ type result struct {
|
||||
//
|
||||
// Date : 18:34 2022/6/30
|
||||
func (r *result) ParseJSON(inputContent []byte, receiver interface{}) error {
|
||||
decoder := json.NewDecoder(bytes.NewReader(inputContent))
|
||||
decoder.UseNumber()
|
||||
return decoder.Decode(receiver)
|
||||
return util.JSON.UnmarshalWithNumber(inputContent, receiver)
|
||||
}
|
||||
|
||||
// ParseYaml 解析yaml数据
|
||||
|
Loading…
Reference in New Issue
Block a user