I am trying to store an API response in attribute myAttr
in extractText
processor but when I am trying to print the value of myAttr
in ExecuteScript
it is giving [object Object]
in output and not printing the entire response of the API.
I think it can be done EvaluateJsonPath
processor but I couldn't understand how.
Execute Script
:
var reasonId = []
try {
var reasonId = JSON.parse(flowFile.getAttribute('SubReason1'));
if (flowFile != null) {
if(reasonId != undefined){
flowFile = session.putAttribute(flowFile, 'myAttr', reasonId);
}
else{
session.transfer(flowFile, REL_FAILURE)
}
session.transfer(flowFile, REL_SUCCESS)
}
}
Output is in myAttr
, the expected output is the entire response of the API.