当提交内容是长度为0的切片时,会被转换成struct类型输出
Closed this issue · 1 comments
iTryIt commented
当提交内容是长度为0的切片时,会被转换成struct类型输出
var testSlice = []int{}
j, _ := json.Marshal(filter.Select("t", testSlice))
fmt.Println(string(j))
期望输出:[]
实际输出:{}
检查后发现是filter/parser.go 311 附近代码导致未按照Slice规则处理空切片
l := valueOf.Len()
if l == 0 {
t.Val = emptySlice
// 此处 t.IsSlice == false
return
}
liu-cn commented
v1.15版本已修复