需要 JOLT spect 将 give JSON 转换为预期输出 json

Need JOLT spect to transform give JSON to expected Output json

输入给定

[
  {
    "correlationId": "12345",
    "payloadFormat": "Money",
    "payload": {
      "County": "Texsas_City",
      "location": "south",
      "name": "Dallas",
      "pop": "2M"
    }
  },
  {
    "correlationId": "ed1e3",
    "payloadFormat": "Cash",
    "payload": {
      "County": "California_City",
      "location": "west",
      "name": "LosAngeles",
      "pop": "4M"
    }
  }
]

预期输出应该是

[
  {
   
    "payload": {
    "correlationId": "12345",
    "payloadFormat": "Money",
      "State": "Texas",
       "City": "_City",
      "location": "south",
      "name": "Dallas",
      "pop": "2M"
    }
  },
  {
   
    "payload": {
    "correlationId": "ed1e3",
    "payloadFormat": "Cash",
      "State": "California",
       "City": "_City",
      "location": "west",
      "name": "LosAngeles",
      "pop": "4M"
    }
  }
]

检查此规范

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "correlationId": "[&1].payload.correlationId",
        "payloadFormat": "[&1].payload.payloadFormat",
        "payload": {
          "location": "[&2].payload.location",
          "name": "[&2].payload.name",
          "pop": "[&2].payload.pop",
          "County": {
            "*_*": {
              "$(0,1)": "[&4].payload.State",
              "$(0,2)": "[&4].payload.City"
            }
          }
        }
      }
    }
  }
]