Support Questions

Find answers, ask questions, and share your expertise

NiFi - Decoding a base64-field in JSON and replacing the coded value with the decoded?

avatar
Explorer

Hi.

I'm using NiFi 1.11.2.

 

I have a set of Json-files which contain a base64-coded field (Jsonpath to this field is $.data.content).  Decoding the field works as expected and I'm able to write the content from this field to a file in a bucket in S3.  But what I would like to do is to be able to replace the coded value for this field with the decoded value in stead of writing the decoded value to file. And after replacing the value write the updated Json-file to a new S3 bucket.

I'm thinking taking the output from RouteOnAttribute and ConvertRecord in the figure below and perhaps use UpdateRecord or ReplaceText. But I'm not sure how to do this.

What is the best way to "re-connect" the data flow here from these to objects in the process?

Any tips?

 

Thanks

bjornmy

 

 
 
 
 

nifi.png

1 ACCEPTED SOLUTION

avatar
Explorer

Just a short update.

I solved this by using the ExecueGroovyScript process and made a short groovy-script that took care of the transformation.

View solution in original post

11 REPLIES 11

avatar
Explorer

Just a short update.

I solved this by using the ExecueGroovyScript process and made a short groovy-script that took care of the transformation.

avatar
Contributor

Hey @bjornmy I am looking to resolve the same kind of issue do you have the groovy-script to share?

 

Thanks,

Vasu