Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

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

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

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

 

$.HR.finance.name

$.HR.finance.age

View solution in original post

7 REPLIES 7

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

 

$.HR.finance.name

$.HR.finance.age

Rising Star

ohh my BAD, thank you Steven.

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

 

 

 

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’)}

 

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.

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.

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.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.