无法使用颠簸变换在 json 以下进行变换

Unable to transform below json using jolt transformation

我有一个 JSON,其中有打板球的 studentId,我想要组数组中每个对象的学生列表。但是输出正在合并到同一个学生列表中。我尝试迭代每个 studentId 并获得以下输出。我希望得到如下 expected/desired 格式的输出。有帮助吗?

输入:

{
  "studentEligibility": {
    "sportsEligibility": {
      "cricketEligibility": [
        {
          "group": [
            {
              "multiPlayGame": [
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_209537"
                },
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_217649"
                }
              ]
            }
          ]
        },
        {
          "group": [
            {
              "multiPlayGame": [
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_217609"
                }
              ]
            },
            {
              "multiPlayGame": [
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_216386"
                }
              ]
            }
          ]
        },
        {
          "group": [
            {
              "multiPlayGame": [
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_217008"
                },
                {
                  "studentId": "2aefcb01-fe81-4760-b531-9767c2e6d322_217628"
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

颠簸规格:

[
  {
    "operation": "shift",
    "spec": {
      "studentEligibility": {
        "sportsEligibility": {
          "cricketEligibility": {
            "*": {
              "group": {
                "*": {
                  "multiPlayGame": {
                    "*": {
                      "studentId": "team[&5].players[]"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
]

当前输出:

{
  "team": [
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_209537",
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217649"
      ]
    },
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217609",
        "2aefcb01-fe81-4760-b531-9767c2e6d322_216386"
      ]
    },
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217008",
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217628"
      ]
    }
  ]
}

预期/期望输出:

{
  "team": [
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_209537",
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217649"
      ]
    },
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217609"
      ]
    },
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_216386"
      ]
    },
    {
      "players": [
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217008",
        "2aefcb01-fe81-4760-b531-9767c2e6d322_217628"
      ]
    }
  ]
}

Jolt 规范解决方案

[
  {
    "operation": "shift",
    "spec": {
      "studentEligibility": {
        "sportsEligibility": {
          "cricketEligibility": {
            "*": {
              "group": {
                "*": "teams[].players[]"
              }
            }
          }
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "teams": {
        "*": {
          "players": {
            "*": {
              "multiPlayGame": "team.players[]"
            }
          }
        }
      }
    }
  },

  {
    "operation": "shift",
    "spec": {
      "team": {
        "players": {
          "*": {
            "*": {
              "studentId": "team[&2].players[]"
            }
          }
        }
      }
    }
  }
]