I am creating a NiFi pipeline to send phone numbers to a phone number normalizer. I have used EvaluateJSONPath to put all the phone numbers into NiFi attributes, then used ReplaceText to overwrite the flowfile content with the input JSON and the values of the attributes. Here's the input JSON used in ReplaceText:
I am currently able to accomplish this using regex and 2 ReplaceText processors to make the replacements and clean up dangling/missing commas and other formatting issues, but it basically just treats the JSON like a string instead of a data structure.
Is there a better way to do this that treats JSON like a data structure and doesn't risk creating invalid JSON?