- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to transform a json array into a string list in NIFI
- Labels:
-
Apache NiFi
Created 05-22-2017 03:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
i have a queryCassandra which generate a json like this one:
{"results":[{"term":"term1"},{"term":"term2"}..]}
Now, i want to get from this all the terms values separated by some separator in string format;
ex : term1,term2,term3
So i can pass this list as a string parameter for a java main program which i've alreat set.
(i only need the transofrmation, not the java program execution) Thank you !
Created 05-23-2017 04:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @brian adi
You can use the SplitJson processor to get the array into individual flowfile records, then use EvaluateJsonPath to pull out the values of interest, and ReplaceText to get the content back into a CSV format. Here is a good example with screenshots showing how to do this using NiFi
https://community.hortonworks.com/articles/64069/converting-a-large-json-file-into-csv.html
As always, if you find this post useful, don't forget to accept the answer.
Created 05-23-2017 04:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @brian adi
You can use the SplitJson processor to get the array into individual flowfile records, then use EvaluateJsonPath to pull out the values of interest, and ReplaceText to get the content back into a CSV format. Here is a good example with screenshots showing how to do this using NiFi
https://community.hortonworks.com/articles/64069/converting-a-large-json-file-into-csv.html
As always, if you find this post useful, don't forget to accept the answer.
