使用Jolt Nifi规范组合Json行



输入:

[{
"Store_id": "store_0",
"Item_id": "item_0",
"Quantity": "26",
"Date": "2019-05-01",
}, {
"Store_id": "store_0",
"Item_id": "item_0",
"Quantity": "17",
"Date": "2019-05-02"
}, {
"Store_id": "store_0",
"Item_id": "item_1",
"Quantity": "47",
"Date": "2019-05-01",
"CREATED_DT": "2019-10-09 20:45:47.0",
"CREATED_BY": "di_user"
}]

所需输出:

[order: {
"Store_id": "store_0",
"Date": "2019-05-01"
items:[
{item: item_0 , Quantity:26}]},
{
"Store_id": "store_0",
"Date": "2019-05-02"
items:[
{item: item_0 , Quantity:17}]}

如果我正确阅读了你的输出,下面的规范应该有效:

[
{
"operation": "shift",
"spec": {
"*": {
"Store_id": "order[&1].Store_id",
"Date": "order[&1].Date",
"Item_id": "order[&1].items[#].item",
"Quantity": "order[&1].items[#].Quantity"
}
}
}
]

最新更新