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!

Not getting Expected output Using Jolt in NiFi

avatar
Contributor

Hi Team,

 

I am using Jolt for the input:

{
"headers": {
"query": "NA",
"param": "false"
},
"data": [
{
"SEQ_NUM": [
162,
162,
162,
162,
162,
162,
162,
162
]
},
{
"SEQ_NUM": [
162,
162,
162,
162,
162,
162,
162,
162
]
}
]
}

 

 

Jolt Spec:

[{
"operation": "shift",
"spec": {
"data": {
"*": {
"SEQ_NUM": {
"*": {
"@": "[&1].SEQ_NUM"
}
}
}
}
}
}
]

 

Output:

[ {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
}, {
"SEQ_NUM" : [ 162, 162 ]
} ]

 

Expected Output:

[ {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
}, {
"SEQ_NUM" : 162
} ]

 

Can you please help me with the same.

Thank you

1 ACCEPTED SOLUTION

avatar
Expert Contributor

Hello @Techie123,

can you tell a bit more about what you want to achive?

 

Do you want just use the first or second object of 'data'?

Then you have to change:

"data": {
"0": {
"data": {
"1": {

 Or how do you want to progress - can it that the numbers are not similiar?

We dont know how your results can be look like

 

Greetings

View solution in original post

1 REPLY 1

avatar
Expert Contributor

Hello @Techie123,

can you tell a bit more about what you want to achive?

 

Do you want just use the first or second object of 'data'?

Then you have to change:

"data": {
"0": {
"data": {
"1": {

 Or how do you want to progress - can it that the numbers are not similiar?

We dont know how your results can be look like

 

Greetings