Apache nifi 无法使用JOLT转换将数组中的字段组转换为相应的单个数组

Apache nifi 无法使用JOLT转换将数组中的字段组转换为相应的单个数组,apache-nifi,jolt,Apache Nifi,Jolt,输入: 震动规格: { "chain": [ { "formation": [ { "itemID": "1111", "isConsiderable": false }, { "itemID": "2222",

输入:

震动规格:

{
  "chain": [
    {
      "formation": [
        {
          "itemID": "1111",
          "isConsiderable": false
        },
        {
          "itemID": "2222",
          "isConsiderable": false
        }
      ]
    },
    {
      "formation": [
        {
          "itemID": "3333",
          "isConsiderable": false
        },
        {
          "itemID": "4444",
          "isConsiderable": false
        }
      ]
    }
  ]
}
电流输出:

    [
  {
    "operation": "shift",
    "spec": {
      "chain": {
        "*": {
          "formation": {
            "*": {
              "itemID": "productsList[&1].products"
            }
          }
        }
      }
    }
}
]
期望输出:

    {
  "productsList" : [ {
    "products" : [ "1111", "3333" ]
  }, {
    "products" : [ "2222", "4444" ]
  } ]
}
我想匹配每个编队数组的itemID,并将它们分组到各自的数组中。 通过使用jolt转换,我可以对products数组进行分组,但不能按照所需的格式进行分组,并且希望对各个数组的itemID进行分组,但在这里对输入json中所有数组的相同索引上发生的字段进行分组


提前感谢

在您的规范中
&1
指存储在
formation
键下的数组中的索引。您需要在链式数组(
&3
)中指定索引,然后在
数组中指定索引-如下规范所示:

[
{
“操作”:“移位”,
“规格”:{
“链”:{
"*": {
“形成”:{
"*": {
“项目ID”:“产品列表[&3]。产品[&1]”
}
}
}
}
}
}
]

@kapstom-你能帮我解决这个问题吗
  {
    "productsList" : [ {
    "products" : [ "1111", "2222" ]
          }, {
    "products" : [ "3333", "4444" ]
     } ]
   }