From a29a211ee5fe271de3e8ffc7da55ae4049ca94dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 9 Nov 2021 22:45:20 +0800 Subject: [PATCH] =?UTF-8?q?list=20object=20=E8=A7=A3=E6=9E=90=E6=88=90[]ma?= =?UTF-8?q?p[string]interface{}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/json2go/parser.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tool/json2go/parser.go b/tool/json2go/parser.go index 0576fc2..2aef5b4 100644 --- a/tool/json2go/parser.go +++ b/tool/json2go/parser.go @@ -95,6 +95,10 @@ func (jg *JSON2GO) parseArray(key string, parseResult gjson.Result) { return } } + // 对象,重新 + if dataType == "object" { + dataType = "map[string]interface{}" + } // 所有数据类型都一致 if len(key) == 0 { jg.append("[]" + dataType)