如何在颠簸变换中的数组中添加索引

How to add indices in an array in jolt transformation

我正在尝试修改我的输入并使用“-indexNum”为每个对象添加一个 ID,但这似乎不是 working.Here我正在发布我的代码。

我的输入,

 {
   "employees": [{
        "f_name": "tom",
        "l_name": "smith"
    },
    {
        "f_name": "don",
        "l_name": "jones"
    }
 ]
}

预计o/p:

{
"employees": [{
    "firstName": "tom",
    "lastName": "smith",
    "test": "emp-"
}, {
    "firstName": "don",
    "lastName": "jones",
    "test": "emp-"
}]
}

我的规格,

[{
    "operation": "shift",
    "spec": {
        "employees": {
            "*": {
                "f_name": "employees[&1].firstName",
                "l_name": "employees[&1].lastName"
            }
        }
    }
},
{
    "operation": "modify-overwrite-beta",
    "spec": {
        "employees": {
            "*": {
                "test": "=concat('emp-',)"
            }
        }
    }
}]

我正在尝试修改我的输入并使用“-indexNum”为每个对象添加一个 ID。任何人都可以给我建议 help.Thanks。

规格

[
  {
    "operation": "shift",
    "spec": {
      "employees": {
        "*": {
          "$": "employees[&1].employeeNum",
          "f_name": "employees[&1].firstName",
          "l_name": "employees[&1].lastName"
        }
      }
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "employees": {
        "*": {
          "employeeNum": "=concat('emp-',@(1,employeeNum))"
        }
      }
    }
  }
]