diff --git a/tool/json2go/parser.go b/tool/json2go/parser.go index 61918d5..0576fc2 100644 --- a/tool/json2go/parser.go +++ b/tool/json2go/parser.go @@ -80,7 +80,12 @@ func (jg *JSON2GO) parseArray(key string, parseResult gjson.Result) { dataType = jg.getDataType(item) continue } - if jg.getDataType(item) != dataType { + currentType := jg.getDataType(item) + if currentType != dataType { + if (dataType == "int64" && currentType == "float64") || (dataType == "float64" && currentType == "int64") { + dataType = "float64" + continue + } // 不是所有数据类型都一致 if len(key) == 0 { jg.result += "interface{}"