# Node-red-contrib-redis, help with JSON.set and argument format

**URL:** <https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920>\
**Category:** General\
**Created:** [12 September 2024 18:43 UTC](https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920 "2024-09-12T18:43:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HarryPottar](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@HarryPottar](https://discourse.nodered.org/u/HarryPottar)\
**Post date:** [12 September 2024 18:43 UTC](https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920/1 "2024-09-12T18:43:20Z")

</div>

Hello,

This is the [module](https://flows.nodered.org/node/node-red-contrib-redis) I'm I'm using

I'm familiar with Redis and have successfully set up Publish and Subscribe workflows.

Also, I successfully set up LPUSH and RPOPLPUSH workflows.

By default, Redis stores information as a key-value pair where the value is a string, and I've been serializing JSON to a string for this.

I now need to start working with JSON. Objects in Redis, I have a Redis Stack server running with the JSON module and can set and get JSON in the redis-cli.

```auto
JSON.SET 'JBV315EByZ3blpuIOf26' $ '{"index":"audit-trail","documentId":"JBV315EByZ3blpuIOf26","timestamp":"2024-09-09T15:46:13.671Z","event":{"nodeId":"5","filespace":"lucid.blansys","filespaceUuid":"7e9bee12-f4c2-4a8b-b494-5cf69fbbec2e"},"source":{"offset":"1640","filename":"/media/lucidlink/.lucid_audit/5/2024/09/2024-09-09T15.34.23Z.log.active"},"operation":{"action":"Move","entryPath":"/image019.jpeg","fileId":"5:10098"},"device":{"hostName":"Deans-MacBook-Pro.local","osVersion":"23.6.0","osName":"Darwin"},"user":{"name":"DeanHolmes","id":"eb5eb7b2-7a33-45d5-b8ee-2ba254038712"},"target":{"destination":"","process":"new","lastupdate":""}}'

```

I'm trying the same through the Node-Red Redis plugin, I have tried many permutations of the arguments and get the same error.

```auto
"ReplyError: ERR wrong number of arguments for 'json.set' command"

```

I have tried sending the payload as

```auto
[
    '{{{documentID}}}',
    '$'
    '{{{payload}}}'
]

```

I have sent the key under msg,topic and payload

```auto
[
    '$',
    '{{{payload}}}'
]

```

I have tried without the root '$,' and I always have the same error.

I have tried setting some of the params in the module prefs

![Screenshot 2024-09-12 at 2.31.39 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/aca7f2e3436040fbad6424ddd3e50728673d24f4.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 September 2024 09:05 UTC](https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920/2 "2024-09-13T09:05:41Z")

</div>

What redis node are you using seeing that there are 11 that can be found in the flow library.

---

<div class="post-metadata">

**Author:** ![HarryPottar](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@HarryPottar](https://discourse.nodered.org/u/HarryPottar)\
**Post date:** [16 September 2024 16:04 UTC](https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920/3 "2024-09-16T16:04:18Z")

</div>

I am unsure why this did not work during one of my tests, but I returned a couple of days later and got it working.

Using a function node

```auto
let jsonPayload = JSON.stringify(msg.payload);

msg.payload = [];
msg.payload.push("indx:sys:" + msg.documentID);
msg.payload.push("$");
msg.payload.push(jsonPayload);
return msg;

```

Then used a redis cmd connector

![Screenshot 2024-09-16 at 12.03.22 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/8/18431515f58dcacaa57ffacc8836f509d397629b.png)

All working now.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 September 2024 16:04 UTC](https://discourse.nodered.org/t/node-red-contrib-redis-help-with-json-set-and-argument-format/90920/4 "2024-09-30T16:04:46Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
