将两个数组转换为单个对象数组

Convert two arrays into single array of objects

我有两个数组,需要使用 jolt 将这些数组转换为单个对象数组。

输入

"Name": ["Test  Test", "Test2  Test"]
"email": ["Test@tesasds.com", "Test2@test.com"]

输出

[{"Name":"Test  Test","email":"Test@tesasds.com"},{"Name":"Test2  Test","email":"Test2@test.com"}]

内联说明:

[
  {
    "operation": "shift",
    "spec": {
      // for every key
      "*": {
        // and every item in the array
        "*": {
          // create a structure <index of array> : key : value
          // This will therefore join the two because the indexes will be the same
          "@": "&.&2"
        }
      }
    }
  },
  {
    //Remove the index as key
    "operation": "shift",
    "spec": {
      "*": "[]"
    }
  }
]

我建议 运行 第一个班次以了解描述。