I transform csv data to json and write that information to PutFTP, the extension of the file output is csv and not json. How can I override this information for the PutFTP processor.
I transform csv data to json and write that information to PutFTP, the extension of the file output is csv and not json. How can I override this information for the PutFTP processor.
Use an UpdateAttribute processor to change the filename attribute of the flowfile from example.csv to example.json.
A more dynamic answer when using UpdateAttribute is to use NiFi expressions to change the filename:
So to change dynamc_name.txt to dynamc_name.json
Set your NiFi UpdateAttribute filename to:
${filename:substring(0,11).json}
Expression Value
${filename:substring(0,1)} a
${filename:substring(2)} brand new filename.txt
${filename:substring(12)} filename.txt
${filename:substring( ${filename:length():minus(2)} )} xt
Reference: https://docs.cloudera.com/HDPDocuments/HDF3/HDF-3.0.2/bk_expression-language/content/substring.html
I agree that the UpdateAttribute worked well but struggled to find an expression that worked with it. After some testing and research I arrived at this solution.
${filename:substringBeforeLast('.'):append('.json')}