diff --git a/gjson_hack/precision.go b/gjson_hack/precision.go index 9d1d8f5..d2c3461 100644 --- a/gjson_hack/precision.go +++ b/gjson_hack/precision.go @@ -143,7 +143,8 @@ func Any(sourceValue gjson.Result) (any, error) { func getRealDataType(dataType consts.DataType, sourceValue gjson.Result) consts.DataType { // 指针数据类型, 转换为普通数据类型处理 dataType = consts.DataType(strings.TrimLeft(dataType.String(), "*")) - if dataType == consts.DataTypeAny { + // 没指定数据类型或者数据类型是any + if dataType == consts.DataTypeAny || dataType == "" { if sourceValue.IsObject() { dataType = consts.DataTypeMapAnyAny } else if sourceValue.IsArray() { @@ -153,6 +154,10 @@ func getRealDataType(dataType consts.DataType, sourceValue gjson.Result) consts. } else { if sourceValue.Type == gjson.Number { dataType = consts.DataTypeFloat64 + } else if sourceValue.Type == gjson.String { + dataType = consts.DataTypeString + } else { + dataType = consts.DataTypeAny } } }