Try base64 encoding the JSON string with EL and then having Python decode
the parameter.

https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#base64encode

On Wed, Jun 26, 2019 at 9:14 AM Tomislav Novosel <[email protected]>
wrote:

> Hi all,
>
> I have a case where I'm triggering python script with ExecuteStreamCommand
> processor and one of the parameters needs to be JSON string e.g.
> '{"foo":"bar"}', so when the script receives it, it need to convert it into
> python dictionary.
>
> The error is due to incorrect handover of parameter as JSON string, so the
> Nifi gives the script this parameter without double and single quotes e.g.
> {foo:bar}. So why is that? Is there any workaround?
>
> I checked that with simple part where I wrote parameter value into txt
> file where the script is located.
>
> I also tried with expression escapeJson(), so for given parameter
> '{"fo":"bar"}', expression converts it into '{\"foo\":\"bar\"', but
> ExecuteStreamCommand processor receives it like '{\foo\:\bar\}'.
>
> Thank you.
> BR,
> Tom
>

Reply via email to