我有以下 json,只想过滤几个对象 -
{
"field1": "xyz",
"field2": "mno",
"res1": "pqrs",
"folder": "/folder-parent/raw/new"
},
{
"field1": "xyz1",
"field2": "mno1",
"res1": "pqrs1",
"folder": "/folder-parent/raw/old"
},
{
"field1": "xyz1",
"field2": "mno1",
"res1": "pqrs1",
"folder": "/folder-parent/changed-per-record"
},
{
"field1": "xyz1",
"field2": "mno1",
"res1": "pqrs1",
"folder": "/folder-parent/something-else"
},
{
"field1": "xyz1",
"field2": "mno1",
"res1": "pqrs1",
"folder": "/folder-parent/something/other-thing"
}
]
我需要使用
/folder-parent/raw/new /folder-parent/raw/old /folder-parent/change-per-record
过滤对象
我试过了,但不起作用
[ { "operation": "shift", "spec": { "*": { "folder": { "*": { "filter": "@(2, folder)=== '/folder-parent/raw/new' && @(2, folder)=== '/folder-parent/raw/old' && @(2, folder)=== '/folder-parent/change-per-record'", "": "@" } } } } } ]
这种情况请帮忙
嗨希望这可以帮助您解决您的疑问
[
{
"operation": "shift",
"spec": {
"*": {
"folder": {
"/folder-parent/raw/new|/folder-parent/raw/old|/folder-parent/change-per-record": {
"@2": "[#3]"
}
}
}
}
}
]