我有一个要求,包括记录计数作为一个标题。所以尝试了下面的JOLT,但它不工作
我正面临一个问题,转换一个非常复杂的JSON输入和输出的详细信息如下所示。
输入
[
{
"Location": "A",
"Item": "X",
"Planning_Month": "Jan",
"Production_Plant": "Plant1",
"GM_M_Load_Plan_Planned_Supply": 100,
"Total_Count": 75
},
{
"Location": "B",
"Item": "X",
"Planning_Month": "Jan",
"Production_Plant": "Plant1",
"GM_M_Load_Plan_Planned_Supply": 1001,
"Total_Count": 75
},
{
"Location": "C",
"Item": "X",
"Planning_Month": "Jan",
"Production_Plant": "Plant1",
"GM_M_Load_Plan_Planned_Supply": 1001,
"Total_Count": 75
}
]
Jolt I m Using
[
{
"operation": "shift",
"spec": {
"*": {
"Total_Count": "response.Total_Count",
"Location": "message[&1].Location",
"Item": "message[&1].Item",
"Planning_Month": "message[&1].Planning_Month",
"Production_Plant": "message[&1].Production Plant",
"W_Load_Planned_Supply": "message[&1].W Load Planned Supply"
}
}
}
]
预期输出
{
"response": {
"Total_Count": 75
},
"message": [
{
"Location": "A",
"Item": "X",
"Planning_Month": "Jan",
"Production Plant": "Plant1"
},
{
"Location": "B",
"Item": "X",
"Planning_Month": "Jan",
"Production Plant": "Plant1"
},
{
"Location": "C",
"Item": "X",
"Planning_Month": "Jan",
"Production Plant": "Plant1"
}
]
}
请帮助任何人谁是一个颠簸Maven,帮助我得到所需的输出。我想我卡在最后一步了
1条答案
按热度按时间7fhtutme1#
您可以再添加一个spec,其类型为cardinality,如下所示
考虑到所有对象具有相同的
Total_Count
值