数组的 Jolt 转换 - 适用于一条记录但不适用于数组

Jolt transformation for array - works for one record but not for array

我正在尝试修改包含超过 10K 条记录的 JSON 大文件。 我有这种输入,我需要对每条记录进行颠簸转换:

  [
      {
        "id": 1031435,
        "event_id": "Formula_257",
        "formula_id": 257,
        "ts_start": 1583164200084000,
        "ts_end": 1583164484960000,
        "type": "formula",
        "details": {
          "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7": {
            "PowerActiveTriPhase": 183836912
          }
        },
        "ack_ts": null,
        "ack_user": null
      },
      {
        "id": 1031435,
        "event_id": "Formula_257",
        "formula_id": 257,
        "ts_start": 1583164200084000,
        "ts_end": 1583164484960000,
        "type": "formula",
        "details": {
          "6aa0734f-6d6a-4b95-8a2b-2dde346f9df7": {
            "PowerActiveTriPhase": 183836912
          }
        },
        "ack_ts": null,
        "ack_user": null
      }
    ]

这种规范(感谢@Jagadesh)returns 我为空:

[
  {
    "operation": "shift",
    "spec": {
      "id": "id",
      "event_id": "event_id",
      "formula_id": "formula_id",
      "ts_start": "ts_start",
      "ts_end": "ts_end",
      "type": "type",
      "details": {
        "*": {
          "$": "equipment_id",
          "*": {
            "$": "parameter",
            "@": "value"
          }
        }
      },
      "ack_ts": "ack_ts",
      "ack_user": "ack_user"
    }
  }
]

我需要做什么来修复它?

谢谢,

上述规范适用于一个对象, 但是这里我们有对象数组,我们需要通过多遍历一层来执行移位,

[
  {
    "operation": "shift",
    "spec": {
      "*": { //Traverse into the array
        "id": "[&1].id",
        "event_id": "[&1].event_id",
        "formula_id": "[&1].formula_id",
        "ts_start": "[&1].ts_start",
        "ts_end": "[&1].ts_end",
        "type": "[&1].type",
        "details": {
          "*": {
            "$": "[&3].equipment_id",
            "*": {
              "$": "[&4].parameter",
              "@": "[&4].value"
            }
          }
        },
        "ack_ts": "[&1].ack_ts",
        "ack_user": "[&1].ack_user"
      }
    }
  }
]