Support Questions

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

Can't get NiFi to consume a JSON

avatar
Explorer

I am a newbie to NiFi and I am trying to pass a JSON object to NiFi. Having failed at multiple attempts, I am trying a very simple flow as below.

 

I have checked the JSON in online validators and have confirmed that it's a valid JSON file. Yet, I am not getting the output I want i.e. Country and Capital in flow file attributes.

 

Please advise where I am going wrong. Thanks in advance.

RB764_0-1634621309180.pngRB764_1-1634621372142.png

RB764_2-1634621429612.png

 

1 ACCEPTED SOLUTION

avatar
Super Mentor

@RB764 

 

Your EvaluateJsonPath processor configuration is good.  This processor evaluates the json path expressions against the content of the inbound FlowFile and then with "Destination"set to "flowfile-attribute", it will create a new attribute for each dynamic property added to the processor with the value that results from the JsonPath.

Your issue here is that your inbound FlowFile has no content for the EvaluateJsonPath processor to run the json path against.  I see that in your screenshot of the GenerateFlowFile processor you have added a new dynamic property "value" with a value of "{"Country":"Austria","Capital":"Vienna"}".  Dynamic properties become FlowFile attributes themselves on the FlowFile produced and not content.

If you want to specify specific content via GenerateFlowFIle processor, you need to use the "Custom Text" property to do so:

MattWho_0-1634753376086.png

 

If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.

Thank you,

Matt

 

View solution in original post

2 REPLIES 2

avatar
Super Mentor

@RB764 

 

Your EvaluateJsonPath processor configuration is good.  This processor evaluates the json path expressions against the content of the inbound FlowFile and then with "Destination"set to "flowfile-attribute", it will create a new attribute for each dynamic property added to the processor with the value that results from the JsonPath.

Your issue here is that your inbound FlowFile has no content for the EvaluateJsonPath processor to run the json path against.  I see that in your screenshot of the GenerateFlowFile processor you have added a new dynamic property "value" with a value of "{"Country":"Austria","Capital":"Vienna"}".  Dynamic properties become FlowFile attributes themselves on the FlowFile produced and not content.

If you want to specify specific content via GenerateFlowFIle processor, you need to use the "Custom Text" property to do so:

MattWho_0-1634753376086.png

 

If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.

Thank you,

Matt

 

avatar
Explorer

Thanks heaps!, @MattWho. Much appreciated. This solved my issue.