Support Questions

Find answers, ask questions, and share your expertise

Splitting records in Apache Nifi

avatar
Explorer

I am working on jolt transforms processor in apache nifi, I am facing some issue pls help me out.

Input: { "resourceid": "d6315d4d7f0c", "timestamp": [ 166406, 166404, 166504 ], "Key": [ "mem", "net", "diskspace" ], "data": [ 89, 90, 91 ] } Expected output: [ { "resourceid": "d6315d4d7f0c", "timestamp": 166406, "Key": "mem", "data": 89 }, { "resourceid": "d6315d4d7f0c", "timestamp": 166404, "Key": "net", "data": 90 }, { "resourceid": "d6315d4d7f0c", "timestamp": 166504, "Key": "diskspace", "data": 91

} ]

1 REPLY 1

avatar
Super Guru

Hi,

Please try the following spec:

[
  {
    "operation": "shift",
    "spec": {
      "timestamp": {
        "*": {
          "@(2,resourceid)": "[&1].resourceid",
          "@": "[&1].timestamp"
        }
      },
      "Key": {
        "*": {
          "@": "[&1].key"
        }
      },
      "data": {
        "*": {
          "@": "[&1].data"
        }
      }
    }
  }
]

If you find this helpful, please accept solution.

Thanks