我刚接触到震动。 你能告诉我如何使用jolt基于以下输出json消息中的位置,使用数组来转换下面的json消息。
输入消息:
[
["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"],
]
输出消息:
[{
"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"
}, {
"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"
}]
任何帮助表示感谢。
答案 0 :(得分:1)
规格
[
{
"operation": "shift",
"spec": {
"*": { // loop thru the outer array
// each item of the outer array, is an array
// match individual array indicies, and then send them to the
// output with the nice name.
"0": "[&1].policyReference",
"1": "[&1].insuredId",
"2": "[&1].insuredName"
// etc
}
}
}
]