Hi,
I am presented with the task of converting dsv files into json format. The
resulting json format will consist of a number of "joins" between the data
contained in these files. The steps I have identified so far are the
following:

- Read the data from a location;
- Apply some basic transformation such as converting datetime to date
- Generate the final Json by taking into account a number of mappings

I have looked at existing processors/templates and I ended up looking at the
template csv -> json: 

https://cwiki.apache.org/confluence/display/NIFI/Example+Dataflow+Templates

Ideally, my flow should look something like:

GetFile -> ReplaceText (e.g. datetime -> date conversion) ->ExtractText (I
guess this is needed to parse the result of the regex, I believe - correct
me if I am wrong) -> ReplaceText (This is where we are actually building the
mappings into json key-value pairs, is that correct?) -> UpdateAttribute
(Here, I am not sure what it does and why I really need it in my case ->
EvaluateJsonPath and ultimately PutFile (to check the result of the
transformations)

Do you think this is a sensible flow for what I am trying to achieve? Am I
missing any step or using an incorrect approach? 

I have then moved into testing the template with a very simple dsv file and
this is where I have stumbled across issues, which I think lead to the fact
that I am not still sure about the flow itself and how to implement extract
and replace operations. 

So, let's say my dsv looks something like this:

"HEADING1"¦ "HEADING2" ¦ "HEADING3"
 abc               dfs               2000-06-11 5.56.43

My ReplaceText has the replacement value : ${time:format("yyyy-MM-dd'")}
from
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#format
, then I was not sure about the actual search value format for which I made
various attempts. This is one of them:
(0{0,1}[1-9])|(1/d)|(2/d)|(3[0-1])/(0{0,1}[1-9])|(1[0-2])/([1-9]/d):(0{0,1}/d)|(1/d)|(2[0-4]):(0{0,1}/d)|([1-5]/d)
. What should I include in the search value? I have come across a
stackoverflow question and followed a similar approach that would fit my
case, but no success whatsover:
http://stackoverflow.com/questions/36825860/replacetext-processor-configuration

Can you provide a very basic example of how the csv to json template works
or point me to an existing one? 

Thank you for your help, much appreciated. 



--
View this message in context: 
http://apache-nifi-developer-list.39713.n7.nabble.com/Using-the-template-cvs-to-json-to-convert-dsv-files-into-json-format-a-few-questions-tp9738.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.

Reply via email to