Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

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