i have processor InvokeHTTP which gives json result. for instance:
{
"revision" : {
"clientId" : "dc572274-4b71-11b6-e415-b91e391bcf4d",
"version" : 7
},
"id" : "dc572260-4b71-11b6-0371-f73573ab44fe",
"uri" : "http://x.x.x.x:9090/nifi-api/processors/dc572260-4b71-0371-73ab44fe",
"position" : {
"x" : -1021.9568138214972,
"y" : 333.2029958718132
}
}
i want to change the value of version dynamically for each incoming response of InvokeHTTP. how to achieve this?
you can use this sequence of processors:
EvaluateJsonPath
to get value of attribute,UpdateAttribute
to change it, andReplaceText
to substitute old value in content with new one using regular expression.For the
ReplaceText
processor use following parameters:Regexp Replace
strategySearch Value :
(?s)("version"\s*:\s*)(\d+)
Replacement Value :
$1${VERSION}
(where VERSION is an attribute name that holds new value)Here is a nice resource to test the regular expressions: https://regex101.com/r/JOrZNp/1
i could suggest ExecuteScript processor with
groovy
language