支持单层slice提取

This commit is contained in:
白茶清欢 2021-09-10 11:45:47 +08:00
parent 89b8411fb2
commit c92a8516d4

View File

@ -70,7 +70,7 @@ func (f *Filter) Result() (*DynamicJSON, error) {
data := item.Map()
for _, key := range ketList {
if v, exist := data[key]; exist {
result.SetValue(fmt.Sprintf(pathArr[0]+".[%d]."+key, idx), data[key].Raw, v.IsObject() || v.IsArray())
result.SetValue(strings.ReplaceAll(newDataPath, "[]", fmt.Sprintf("[%d]", idx)), data[key].Raw, v.IsObject() || v.IsArray())
}
// 结果集中不存在对应key,丢弃
}