Support Questions
Find answers, ask questions, and share your expertise

Double Quotes removed from JSON message when passing an attribute to ExecuteScriptCommand Processor

New Contributor

Hi,

I am using two steps in Nifi:

1. The first step is InvokeHTTP processor to make a REST API call and receive a JSON response.  I have used "Put Response Body In Attribute"  to store the JSON response into an attribute.

2. The next step is ExecuteStreamCommand processor to invoke Python script and  passing the JSON response attribute from previous step as an input argument.  The Command Argument passed to the processor is:

/home/kavipriya/script/Scaling.py;"${AssetModel}";

 

I am able to read the JSON message within my python script, but the double quotes within original JSON message are removed by Nifi and I get following error when parsing the JSON message:

 

"json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3 column 5 (char 10)"

 

Can someone tell me why are the double quotes removed when JSON message passed as argument and also if there is an option to retain the double quotes.  Thanks for your help!

 

I have attached the screenshots and also the JSON message passed to python script and also the python logs showing double quotes missing when reading the argument.

2 REPLIES 2

New Contributor

Python ScriptPython ScriptNifi FlowNifi FlowLogs written by Python ScriptLogs written by Python ScriptData Provenance viewData Provenance view

Explorer

Hello, I'm having the same problem with the double quotes being removed when you pass a JSON into the ExecuteStreamCommand. Have you been able to find a solution?

; ;