- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Can't get NiFi to consume a JSON
- Labels:
-
Apache NiFi
Created 10-18-2021 10:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 10-20-2021 11:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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
Created 10-20-2021 11:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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
Created 10-20-2021 02:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks heaps!, @MattWho. Much appreciated. This solved my issue.