Jolt如何做这个变换?连接并设置在数组中

Jolt how to do this transform? Concat and set in array

我有这样的输入

    {
    "employee": {
        "id": "123456",
        "firstName": "John",
        "prefFirstName": "Doe",
        "lastName": "John",
        "prefLastName": "John",
        "mgrFirstName": "Mitch",
        "mgrPrefFirstName": "Mitch",
        "mgrLastName": "McEvoy",
        "mgrPrefLastName": "McEvoy",
        "gmFirstName": "GMName",
        "gmPrefFirstName": "GMName",
        "gmLastName": "GMLastName",
        "gmPrefLastName": "GMLastName",
        "dirFirstName": "DirFirstName",
        "dirPrefFirstName": "DirFirstName",
        "dirLastName": "DirLastName",
        "dirPrefLastName": "DirLastName",

    }
}

预期输出应该是这样的,我看不懂粗体中的字段。

"managers" : [ { "chnl" : "eml", "nm": "Mitch McEvoy", “mgrlbl”:“直接经理” }, { "chnl" : "eml", "eml" : "", "nm": "GMName GMLastName", “mgrlbl”:“总经理” }, { "chnl" : "eml", "eml" : "", "nm": "DirFirstName DirLastName", “mgrlbl”:“导演” } ], "nhstdt" : "2020-11-23", "nhmob" : "", "nheml" : "empp@web.com", "mgreml" : [ "testttt@web.com", "testttt@web.com" ], "mgrchnl" : "email", "chnl" : "mob", "nhnm" : "Doe John", "mgrnm" : "Mitch McEvoy"

我有这样的转换,但不知道如何获得所需的输出:

    [

  {
    "operation": "shift",
    "spec": {
      "employee": {

        "prefFirstName": {
          "*": {
            "@1": "tmpFirstName",
            "@(2,prefLastName)": "tmpLastName"
          },
          "": {
            "@(2,firstName)": "tmpFirstName",
            "@(2,lastName)": "tmpLastName"
          }
        },
        "mgrPrefFirstName": {
          "*": {
            "@1": "tmpMgrFirstName",
            "@(2,mgrPrefLastName)": "tmpMgrLastName"
          },
          "": {
            "@(2,mgrFirstName)": "tmpMgrFirstName",
            "@(2,mgrLastName)": "tmpMgrLastName"
          }
        },

        "mgrName": "managers[0].nm",
        "mgrBusEmail": "managers[0].eml",
        "gmName": "managers[1].nm",
        "gmBusEmail": "managers[1].eml",
        "dirName": "managers[2].nm",
        "dirBusEmail": "managers[2].eml",
        "#eml": ["managers[0].chnl", "managers[1].chnl", "managers[2].chnl"]
      }
    }
  },
  {
    "operation": "modify-default-beta",
    "spec": {
      "nhnm": "=concat(@(1,tmpFirstName),' ',@(1,tmpLastName))",
      "mgrnm": "=concat(@(1,tmpMgrFirstName),' ',@(1,tmpMgrLastName))"
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "mode": ["=toInteger", 0]
    }
  }
 ]

但我不知道如何连接 mgrFirstName 和 mgrLastName、gmFirstName 和 gmLastName、dirFirstName 和 dirLastName,连接后我需要在数组 managers[0]、managers[1] 和 managers 中进行设置[2]分别

我无法弄清楚如何在连接 stirngs 后修改我的班次规范中的数组。

您可以先使用 modify-default-beta 规范进行串联,然后在数组中设置所需的字段。这应该让你开始:

[
  {
    "operation": "modify-default-beta",
    "spec": {
      "employee": {
        "mgrFullName": "=concat(@(1,mgrFirstName),' ',@(1,mgrLastName))",
        "gmFullName": "=concat(@(1,gmFirstName),' ',@(1,gmLastName))",
        "dirFullName": "=concat(@(1,dirFirstName),' ',@(1,dirLastName))"
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "employee": {
        "mgrFullName": "managers[0].nm",
        "mgrBusEmail": "managers[0].eml",
        "gmFullName": "managers[1].nm",
        "gmBusEmail": "managers[1].eml",
        "dirFullName": "managers[2].nm",
        "dirBusEmail": "managers[2].eml",
        "#eml": ["managers[0].chnl", "managers[1].chnl", "managers[2].chnl"],
        "#Direct Manager": "managers[0].mgrlbl",
        "#General Manager": "managers[1].mgrlbl",
        "#Director": "managers[2].mgrlbl"
      }
    }
  }
]