prathik vijaykumar
prathik vijaykumar

Reputation: 395

joining particular arrays among many array in json Nifi

I have the following JSON:

{
  "list1":[1,2,3],
  "list2":[4,5,6],
  "list3":[7,8,9]
}

I just want to join list1 and list2.
Thus the desired output is :

{
  "Joined_list":[1,2,3,4,5,6],
  "list3":[7,8,9]
}

What will be the Jolt transform spec expression for this?

Upvotes: 1

Views: 34

Answers (1)

Barbaros Özhan
Barbaros Özhan

Reputation: 65373

You just can use single step of shift transformation such as

[
  {
    "operation": "shift",
    "spec": {
      "list1": {
        "*": {
          "@": "Final_List"
        }
      },
      "list2": {
        "*": {
          "@": "Final_List"
        }
      },
      "list3": "list3"
    }
  }
]

Upvotes: 2

Related Questions