diff --git a/wrapper/json.go b/wrapper/json.go index edc0aa3..37b86f9 100644 --- a/wrapper/json.go +++ b/wrapper/json.go @@ -106,6 +106,11 @@ func (oj *ownJson) generateStructField(rootPath string, currentName string, curr if currentResult.IsArray() { // 数组, 递归处理 arrList := currentResult.Array() + if len(arrList) == 0 { + // 空数组,无法判断类型,使用any + oj.structBuilder.AddField(structPath, "", []any{}, "", false) + return + } if arrList[0].Type == gjson.True || arrList[0].Type == gjson.False { oj.structBuilder.AddField(structPath, "", []bool{}, "", false) return