[英]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.