Support Questions

Find answers, ask questions, and share your expertise

Nifi: How can i replace text only in some specific fields using ReplaceText processor

avatar
Explorer

Greetings,

I have a NIFI flow in which I change a log to a JSON format file and then I need to remove space characters in some of the fields inside the JSON.
I use the ReplaceText processornifi replace text.jpg and I need to know how to limit it so that it performs the replacement operation only on specific fields that I define for it.

Thank you!!

1 REPLY 1

avatar
Expert Contributor

Dont know if it is the best solution, but if you know the keys of the JSON, you can use the Processor 'EvaluateJsonPath' and put the values as attribute to the flowfile.

Then use Processor 'AttributsToJson' and set the JSON key and the value with expression language ${attr:trim()}