I am trying to modify nifi flow file using ReplaceText processor. The source flow file is:
[{"id":1,"name":"Bill"},{"id":2,"name":"Musk"}]
the expected result is:
["data":"{"id":1,"name":"Bill"}","data":"{"id":2,"name":"Musk"}"]
I configured ReplaceText processor with:
1.strattegy = regex replace
2.search value = ({.+?})
3.replacement value = {“data”:”${‘$1’:escapeJson()}”}
I actually got the following result:
["data":"{"id":1,"name":"Bill"}","data":"{"id":2,"name":"Musk"}"]
It seems that the escapeJson function didn’t work. What a mistake have I made?