Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Jolt Transform help on json to add another array layer

avatar
Frequent Visitor

I am a newbie to Nifi Jolt transform.  I've been looking through the document, but still cannot figure out how to do a simple Jolt Transform.

Input:

{"id": 123456,

"manager_id": 98765}

desired output:

{"reportTo": [{"userId": 98765}]}

 

I've got the part to change the manager_id to userId by the following Spec.  But I was stuck how to make it another layer.  Any insights/help to solve this? 

[{
"operation": "shift",
"spec": {
"manager_id": "userId"}
}
}]

1 ACCEPTED SOLUTION

avatar
Super Guru

@learnNifi ,

 

Try this one out: 

 

 

 

 

[
  {
    "operation": "shift",
    "spec": {
      "id": "&",
      "manager_id": "report_to[0].id"
    }
  }
]

 

 

 

 

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

2 REPLIES 2

avatar
Super Guru

@learnNifi ,

 

Try this one out: 

 

 

 

 

[
  {
    "operation": "shift",
    "spec": {
      "id": "&",
      "manager_id": "report_to[0].id"
    }
  }
]

 

 

 

 

 

Cheers,

André

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
Frequent Visitor

This works perfectly!  Thank you