[英]Extract Max/earliest date from JSON message in dataweave 2.0
我的訊息結構:
{
"empid": "abc",
"homeCountry": "IND",
"dateOfBirth": "1969-01-01",
"personalInformation": [
{
"salutation": "Mr",
"firstName": "Ram",
"lastName": "Naresh"
}
],
"EmpInfo": [
{
"hireDate": "2000-01-01",
"LevDate": "2018-07-25",
"jobInformation": [
{
"isFullTimeEmployee": true,
"jobTitle": "Engineer",
"effectiveStartDate": "2018-01-05"
},
{
"isFullTimeEmployee": true,
"jobTitle": "Store Manager",
"effectiveStartDate": "2019-01-05"
}
]
}
]
}
我想提取相同的最大日期和索引,以便可以將其聲明為var並在映射中使用它。
您的問題還不夠清楚。 您要使用哪個日期字段? 在這里,我創建了一個解決方案,該解決方案返回具有最舊的effectiveStartDate
jobInformation
的索引和值
payload.EmpInfo[0].jobInformation
map ((item, index) -> {value: item, index: index})
maxBy ((item) -> item.value.effectiveStartDate as Date)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.