admin管理员组文章数量:1434955
Iam new to jolt. Can you please tell me how can i trasform the below json message with array based upon the position in to the below output json message using jolt.
input message :
[
[
"20084541",
"12020584",
"Frohmann Dov",
"2017",
"2",
"75",
"T7",
"DFZ",
"CES",
"",
"",
"0",
"90",
"2010"
],
[
"20084541",
"12020584",
"Frohmann Dov",
"2017",
"3",
"21",
"T7",
"DFZ",
"CES",
"",
"",
"0",
"90",
"2010"
]
]
output Message :
[
{
"policyReference": "20084541",
"insuredId": "12020584",
"insuredName": "Frohmann Dov",
"uwy": "2017",
"subLOB": "2",
"typeOfRisk": "75",
"aircraftcountryCode": "T7",
"aircraftId": "DFZ",
"manufacturerId": "CES",
"aircraftTypeCode": "",
"aircraftSubTypeCode": "",
"aircraftValueAmt": "0",
"aircraftWorkNo": "90",
"yearBuilt": "2010",
"count": 1
},
{
"policyReference": "20084541",
"insuredId": "12020584",
"insuredName": "Frohmann Dov",
"uwy": "2017",
"subLOB": "2",
"typeOfRisk": "75",
"aircraftcountryCode": "T7",
"aircraftId": "DFZ",
"manufacturerId": "CES",
"aircraftTypeCode": "",
"aircraftSubTypeCode": "",
"aircraftValueAmt": "0",
"aircraftWorkNo": "90",
"yearBuilt": "2010",
"count": 2
}
]
Just adding the count to array of elements
Iam new to jolt. Can you please tell me how can i trasform the below json message with array based upon the position in to the below output json message using jolt.
input message :
[
[
"20084541",
"12020584",
"Frohmann Dov",
"2017",
"2",
"75",
"T7",
"DFZ",
"CES",
"",
"",
"0",
"90",
"2010"
],
[
"20084541",
"12020584",
"Frohmann Dov",
"2017",
"3",
"21",
"T7",
"DFZ",
"CES",
"",
"",
"0",
"90",
"2010"
]
]
output Message :
[
{
"policyReference": "20084541",
"insuredId": "12020584",
"insuredName": "Frohmann Dov",
"uwy": "2017",
"subLOB": "2",
"typeOfRisk": "75",
"aircraftcountryCode": "T7",
"aircraftId": "DFZ",
"manufacturerId": "CES",
"aircraftTypeCode": "",
"aircraftSubTypeCode": "",
"aircraftValueAmt": "0",
"aircraftWorkNo": "90",
"yearBuilt": "2010",
"count": 1
},
{
"policyReference": "20084541",
"insuredId": "12020584",
"insuredName": "Frohmann Dov",
"uwy": "2017",
"subLOB": "2",
"typeOfRisk": "75",
"aircraftcountryCode": "T7",
"aircraftId": "DFZ",
"manufacturerId": "CES",
"aircraftTypeCode": "",
"aircraftSubTypeCode": "",
"aircraftValueAmt": "0",
"aircraftWorkNo": "90",
"yearBuilt": "2010",
"count": 2
}
]
Just adding the count to array of elements
Share Improve this question edited Nov 18, 2024 at 11:22 Barbaros Özhan 65.6k11 gold badges36 silver badges62 bronze badges asked Nov 18, 2024 at 11:20 vyshnavi damavyshnavi dama 11 silver badge1 Answer
Reset to default 1You can use the following transformation spec :
[
{
"operation": "shift",
"spec": {
"*": {
"0": "[&1].policyReference",
"1": "[&1].insuredId",
"2": "[&1].insuredName",
"3": "[&1].uwy",
"4": "[&1].subLOB",
"5": "[&1].typeOfRisk",
"6": "[&1].aircraftcountryCode",
"7": "[&1].aircraftId",
"8": "[&1].manufacturerId",
"9": "[&1].aircraftTypeCode",
"10": "[&1].aircraftSubTypeCode",
"11": "[&1].aircraftValueAmt",
"12": "[&1].aircraftWorkNo",
"13": "[&1].yearBuilt",
"$": "[&1].count"
}
}
},
{//originally indexes starts from zero, so need to increment them by one
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"count": "=intSum(1,@(1,&))"
}
}
}
]
本文标签: jsonJolt transformation to add count to event object in array objectStack Overflow
版权声明:本文标题:json - Jolt transformation to add count to event object in array object - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745622277a2666757.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论