I have been trying to convert my integer and string values to JSON format using replacetext processor in NIFI. But I'm facing problem in regular expression. Can anyone suggest me a Regular Expression in search value and replacement value.
Orginal Text format :
{Sensor_id:2.4,locationIP:2.2,Sensor_value:A}
Expected JSON format
{Sensor_id:2.4,locationIP:2.2,Sensor_value:"A"}

You can use the regex
([\w_]+):([a-zA-Z]\w*)with replacement$1:"$2"as you can see hereBut notice that a valid
JSONshould have quotes in the keys. For example:In this case, I would recommend:
([\w_]+):and replacement"$1":([\w_"]+):([a-zA-Z]\w*)and replacement$1:"$2"I hope it helps
EDIT:
If you want to transform
{Sensor_id:2.4,locationIP:2.2,Sensor_value:A}into{"Sensor_id":"2.4","locationIP":"2.2","Sensor_value":"A"}you can use only one regex in a single processor:Regex:
([\w_]+):([.\w]*)Replacement:"$1":"$2"