Support Questions

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

Facing problem while extracting the data from json flow file using EvaluateJsonPath in NiFi

avatar
Rising Star

Hi,

I am receiving the flowfile from ConsumerKafka in json form.

 

ConsumerJson.PNG

 

Then I am using EvaluateJsonPath to extract the json data once the data matched, i want call RouteOnAttribute to call script, but the expression which i have used  in EvaluateJsonPath   processor looks to be wrong and throwing out unmatched info.

EvaluateJsonParser.PNG

Plz help me out to add right expression to extract  the fields

 

1 ACCEPTED SOLUTION

avatar
Super Guru

Based on your content, the values are accessed as follows:

 

$.HR.finance.name

$.HR.finance.age

View solution in original post

7 REPLIES 7

avatar
Super Guru

Based on your content, the values are accessed as follows:

 

$.HR.finance.name

$.HR.finance.age

avatar
Rising Star

ohh my BAD, thank you Steven.

avatar
Rising Star

Hi Steven,

I doing a poc(learning nifi and doing it),  getting the data successfully from EvaluteJasonPath its going to matched processor with the only extracted data, but the flow file is missing when it is going to RouteOnAttribute, I could see only data extracted present but total flow file is missing, because of this my condition is not getting validated and going to unmatched status.

RouteOnAttribute.PNG

 

 

 

avatar
Super Guru

In the routeonattribute proc you use just the ${attribute:equals(‘value’)} that you parsed from evaluatejson proc.

 

Evaluatejson:

attribute = $.HR.finance.name 

 

RouteOnAttribute

${attribute:equals(‘Murali’)}

 

avatar
Rising Star

Hi Steven,

Great Thank full to you, I tried the workaround but its failed, the problem is the attribute is not coming out from EvaluateJasonPath, the attribute which I supposed to use in RouteOnAttribute for comparison.

The following is the output of attributes property file from EvalueJasonPath processor.

flowfileAttribute.PNG If I get attribute HR.finance.user from EvaluateJasonPath, then i can use that attribute in RouteOnAttribute for comparison of attribute value.

avatar
Rising Star

The issue is I was not using right value for the attribute Destination, the value suppose to be flowfile-attribute in my case.

 

Thanks Steven for suggestions.

avatar
Super Guru

Ahh I did not pay attention to that in the original screen shot, just tried to offer the syntax for the json parsing.   Glad you got it to work!   Isn't learning NiFi fun?  I love it.