From eb2302301fdf1a1f1dec47da16deccf95e79441f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 4 Jul 2022 11:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96json=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.sum | 2 -- result.go | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/go.sum b/go.sum index 4c68b35..0b2fb67 100644 --- a/go.sum +++ b/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= diff --git a/result.go b/result.go index f7f421c..93a2250 100644 --- a/result.go +++ b/result.go @@ -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数据