Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Jolt Spec for populating field based on value of another field

Solved Go to solution

Jolt Spec for populating field based on value of another field

Explorer

I want to populate my target JSON with a field based on value of another field.

e.g.

Input JSON:
[

{
"examUrl": "https://exam.test.com/page/1473161074",
"urlTypeName": "Spring URL"
},

{
"examUrl": "https://exam.test.com/page/12423222",
"urlTypeName": "Java URL"
},

]

 

Expected Output:

{

"ExamDashBoardURL" : "https://exam.test.com/page/1473161074"

}

In the above example, I will populate ExamDashBoardURL only if urlTypeName is "Spring URL".

Can anyone please help me on this.

Thanks and Regards,

Biswa

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Jolt Spec for populating field based on value of another field

Explorer

I found out the solution. It may be helpful for someone.

If anyone has better spec, please let me know

[
{
"operation": "shift",
"spec": {
"*": {
"urlTypeId": {
"1": {
"@2": "domoDashboardLink"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"domoDashboardLink": {
"examUrl": "&1"
}
}
}
]

View solution in original post

1 REPLY 1
Highlighted

Re: Jolt Spec for populating field based on value of another field

Explorer

I found out the solution. It may be helpful for someone.

If anyone has better spec, please let me know

[
{
"operation": "shift",
"spec": {
"*": {
"urlTypeId": {
"1": {
"@2": "domoDashboardLink"
}
}
}
}
},
{
"operation": "shift",
"spec": {
"domoDashboardLink": {
"examUrl": "&1"
}
}
}
]

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here