Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Highlighted

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.

1 REPLY 1
Highlighted

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

New Contributor

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

Don't have an account?
Coming from Hortonworks? Activate your account here