# Reset trigger node if payload= an object

**URL:** <https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441>\
**Category:** General\
**Created:** [18 October 2025 12:39 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441 "2025-10-18T12:39:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [18 October 2025 12:39 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/1 "2025-10-18T12:39:53Z")

</div>

What am I doing wrong here as it doesn't reset if I send {"state":"off"} as msg payload ?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fc5bbee2f6352a98de86082968938617cc938809.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 October 2025 12:50 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/2 "2025-10-18T12:50:37Z")

</div>

I'd guess you need a json node to convert the object to a string.  
Maybe need single quotes around key and value in the Then send box too.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [18 October 2025 15:45 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/3 "2025-10-18T15:45:09Z")

</div>

It doesn't appear to accept single quotes. Stringifying the payload didn't help either.

Simple flow if someone can help

```auto
[{"id":"56ed77703814555a","type":"trigger","z":"be14baae.1728","name":"Off in 10 seconds","op1":"","op2":"{\"state\":\"off\"}","op1type":"nul","op2type":"json","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"{\"state\":\"off\"}","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":3370,"wires":[["8f3f0fd2507d4503"]]},{"id":"219099257e12f838","type":"inject","z":"be14baae.1728","name":"reset via payload","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"state\":\"off\"}","payloadType":"json","x":450,"y":3340,"wires":[["56ed77703814555a"]]},{"id":"81f7a5ce4d91df35","type":"inject","z":"be14baae.1728","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":440,"y":3390,"wires":[["56ed77703814555a"]]},{"id":"8f3f0fd2507d4503","type":"debug","z":"be14baae.1728","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":3370,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 October 2025 16:01 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/4 "2025-10-18T16:01:42Z")

</div>

Using a json node works for me with you example data injects.

You can use a change node prior with a ternary expression to create msg.reset. If you omit the `:` section of the ternary, then msg.reset will not be created if the expression is false.  
e.g.

```auto
[{"id":"219099257e12f838","type":"inject","z":"613df62afc8a16bf","name":"reset via payload","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"state\":\"off\"}","payloadType":"json","x":160,"y":110,"wires":[["b65866af86638874"]]},{"id":"b65866af86638874","type":"change","z":"613df62afc8a16bf","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"$$.payload.state = \"off\" ? true","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":140,"wires":[["56ed77703814555a"]]},{"id":"81f7a5ce4d91df35","type":"inject","z":"613df62afc8a16bf","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":160,"wires":[["b65866af86638874"]]},{"id":"56ed77703814555a","type":"trigger","z":"613df62afc8a16bf","name":"Off in 10 seconds","op1":"","op2":"{\"state\":\"off\"}","op1type":"nul","op2type":"json","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"{\"state\":\"off\"}","bytopic":"all","topic":"topic","outputs":1,"x":510,"y":140,"wires":[["8f3f0fd2507d4503"]]},{"id":"8f3f0fd2507d4503","type":"debug","z":"613df62afc8a16bf","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":140,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [18 October 2025 16:18 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/5 "2025-10-18T16:18:08Z")

</div>

Thanks yeah that works, but adds an extra node.

I take it that the trigger reset payload cannot be an object then ?  
Does that seem like a bug / omission with the trigger node, as I couldn't see anything to suggest that an object is not permissible.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [18 October 2025 16:46 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/6 "2025-10-18T16:46:56Z")

</div>

> [@Sean-McG](#):
>
> Thanks yeah that works, but adds an extra node.

Damn those extra nodes.

> [@Sean-McG](#):
>
> Does that seem like a bug / omission with the trigger node, as I couldn't see anything to suggest that an object is not permissible.

At a guess, I think it only works on primitive data types.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 October 2025 18:03 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/7 "2025-10-18T18:03:33Z")

</div>

It does seem reasonable that you should be able to test eg if msg.payload.status === "off"

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [18 October 2025 18:41 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/8 "2025-10-18T18:41:16Z")

</div>

I'm guessing that setting up the comparison of Objects (of any sort) is a whole new ball-game as you cannot just compare with `===`.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 October 2025 20:03 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/9 "2025-10-18T20:03:49Z")

</div>

It is all a matter of considering what are the most important enhancements to node-red that the very limited resource available should work on.

---

<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:** [16 January 2026 20:04 UTC](https://discourse.nodered.org/t/reset-trigger-node-if-payload-an-object/99441/10 "2026-01-16T20:04:38Z")

</div>

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