# Passing JSON object (as string) to python script (exec node)

**URL:** <https://discourse.nodered.org/t/passing-json-object-as-string-to-python-script-exec-node/9680>\
**Category:** General\
**Created:** [2 April 2019 06:15 UTC](https://discourse.nodered.org/t/passing-json-object-as-string-to-python-script-exec-node/9680 "2019-04-02T06:15:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elisascheer](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@elisascheer](https://discourse.nodered.org/u/elisascheer)\
**Post date:** [2 April 2019 06:15 UTC](https://discourse.nodered.org/t/passing-json-object-as-string-to-python-script-exec-node/9680/1 "2019-04-02T06:15:05Z")

</div>

Hi,

I have a PLC which sends message object with json object payload. For example :

```auto
{"payload" : { "DB1" : "value" } }

```

I want to pass msg.payload to an exec python node as an argument. But as we can't pass object directly I was thinking about converting the msg.payload json object to a string and then passing it to the python script so that it would look like this :

```auto
python ~/scripts/process.py '{ "DB1" : "value" }'

```

I tried with javascript function but it must returns an object so it doesn't work.  
Do you have any idea ?  
Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 April 2019 06:45 UTC](https://discourse.nodered.org/t/passing-json-object-as-string-to-python-script-exec-node/9680/2 "2019-04-02T06:45:38Z")

</div>

Hi,  
The json node will convert from a string to an object and also from an object to a string. So maybe that will help ?
