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.

Evaluate json for attribute

Solved Go to solution
Highlighted

Evaluate json for attribute

Explorer

Hello,
I would like to implement this logic on nifi:
I have a json array:
[
{
"att1": "1",
"att2": "aaa"
},
{
"att1": "2",
"att2": "bbb"
},
{
"att1": "3",
"att2": "aaa"
},
]

I would like that, according to the attribute, the json was processed to the processA or to the processB.

For example, if att2 is equal "aaa", it was processed to the processA, else it was processed to the processB.
I tried to follow the suggestion of the following solution

https://community.cloudera.com/t5/Support-Questions/Nifi-processor-route-json-array-into-multiple-js...

but it didn't work. Can you give me an alternative?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Evaluate json for attribute

Cloudera Employee

Hi @LuxIsterica,

 

I would split your json (SplitJson) > EvaluateJsonPath ( To turn att2 to an attribute and call it an attribute name ) > RouteOnAttribute ( To see if the attribute name you grabbed equals to aaa ) > Route it either to you found a relationship or unmatched

 

Screen Shot 2019-10-11 at 2.56.56 PM.png

 

2 REPLIES 2

Re: Evaluate json for attribute

Cloudera Employee

Hi @LuxIsterica,

 

I would split your json (SplitJson) > EvaluateJsonPath ( To turn att2 to an attribute and call it an attribute name ) > RouteOnAttribute ( To see if the attribute name you grabbed equals to aaa ) > Route it either to you found a relationship or unmatched

 

Screen Shot 2019-10-11 at 2.56.56 PM.png

 

Re: Evaluate json for attribute

Explorer

Thank you so much! 

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