From 696d31b0f2783ae9527f2fe54e181b777a2f9636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 30 Jun 2022 21:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0JSON=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E7=9A=84=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- result.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/result.go b/result.go index b9f5cda..198a4e9 100644 --- a/result.go +++ b/result.go @@ -8,6 +8,8 @@ package rpc import ( + "bytes" + "encoding/json" "errors" "github.com/tidwall/gjson" "strings" @@ -58,7 +60,9 @@ type result struct { // // Date : 18:34 2022/6/30 func (r *result) ParseJSON(inputContent []byte, receiver interface{}) error { - return nil + decoder := json.NewDecoder(bytes.NewReader(inputContent)) + decoder.UseNumber() + return decoder.Decode(receiver) } // ParseYaml 解析yaml数据