Resigned 및 Terminated 만 활성화되어 있지 않아야 하는 EmployeeStatus 를 기반으로이 개체 배열을 필터링하고 싶습니다 . 여기서 키는 각 객체마다 다르므로.와 같은 논리를 적용 할 수 없습니다. 어떤 제안이나 힌트가 도움이 될 것입니다.item.key.EmployeeStaus=="Resigned" or "Terminated"
입력 페이로드
[
{
"626433000000196190": [
{
"EmailID": "[email protected]",
"Employeestatus": "Resigned"
}
]
},
{
"626433000000196184": [
{
"EmailID": "[email protected]",
"Employeestatus": "Active"
}
]
},
{
"626433000000196178": [
{
"EmailID": "[email protected]",
"Employeestatus": "Active"
}
]
},
{
"626433000000196166": [
{
"EmailID": "[email protected]",
"Employeestatus": "Terminated"
}
]
}
]
필수 출력
[
{
"EmailID": "[email protected]",
"Employeestatus": "Resigned"
},
{
"EmailID": "[email protected]",
"Employeestatus": "Terminated
}
]
아마도 다음과 같습니다.
입력
[
{
"626433000000196190": [
{
"EmailID": "[email protected]",
"Employeestatus": "Resigned"
}
]
},
{
"626433000000196184": [
{
"EmailID": "[email protected]",
"Employeestatus": "Active"
}
]
},
{
"626433000000196178": [
{
"EmailID": "[email protected]",
"Employeestatus": "Active"
}
]
},
{
"626433000000196166": [
{
"EmailID": "[email protected]",
"Employeestatus": "Terminated"
}
]
}
]
스크립트
%dw 2.0
output application/json
---
flatten(payload map
($ mapObject {
b: $ filter ($.Employeestatus != "Active")
}).b -[])
산출
[
{
"EmailID": "[email protected]",
"Employeestatus": "Resigned"
},
{
"EmailID": "[email protected]",
"Employeestatus": "Terminated"
}
]
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다