# Need some help with a varable JSON

**URL:** <https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210>\
**Category:** General\
**Created:** [11 August 2019 07:59 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210 "2019-08-11T07:59:24Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)\
**Post date:** [13 August 2019 13:49 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/23 "2019-08-13T13:49:14Z")

</div>

Not BigTimer. I think it was one of his older nodes call timeout (hence the name I gave mine: mytimeout). I originally used his code as a base but ran into a lot of problems. So I rewrote it. I think my parsing the strings was due to something that would occasional send a JSON string or a Javascript Object. I don't think I tracked down what external application was doing that.

---

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [15 August 2019 18:20 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/24 "2019-08-15T18:20:39Z")

</div>

@Flixm Personally I wouldn't use a node that requires the data in this form.

@colin why should i not use a node which requires this type of data ? ... it works so what´s the main problem of a json compared to javascript.  
maybe i could not understand but i´m interested in

---

<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:** [15 August 2019 20:31 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/25 "2019-08-15T20:31:14Z")

</div>

Because the convention is to use javascript objects to pass data. For example I would expect to have to pass an object something like this

```auto
msg.payload = {
    "timeout": 1000,
    "warning": 30
}

```

not JSON like this

```auto
msg.payload = "{\"timeout\": 1000, \"warning\": 30}"

```

No-one is going to expect to have to pass JSON. Note that the node author has now clarified that he does not recommend JSON and does recommend js objects (which the node does support). He initially tried to support JSON because the code he picked up tried to do that, but he had so much trouble trying to make it work (it is not at all easy) that he has decided it is not a good idea. I believe he is going to clarify the readme accordingly. I trust he will forgive me if I have misrepresented him in this.

---

<div class="post-metadata">

**Author:** ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)\
**Post date:** [17 August 2019 16:07 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/26 "2019-08-17T16:07:24Z")

</div>

Colin, you are correct. JavaScript objects are the preferred way to pass data. This is the standard way node-red works. The extra support was for a few external applications that were not consistent with passing data.

I've updated the Readme, I'm pretty sure I could have another go at it and I will. Let me know any comments for improvements. I've been a bit overworked the last months and my concentration is suffering. I've updated npm but I still need to update my github repos.

---

<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:** [17 August 2019 20:36 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/27 "2019-08-17T20:36:14Z")

</div>

Looks good to me 🙂

---

<div class="post-metadata">

**Author:** ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)\
**Post date:** [18 August 2019 16:07 UTC](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210/28 "2019-08-18T16:07:19Z")

</div>

I've also fixed my ssh key issue with my git repos, so it's updated on github also.

[Previous page](https://discourse.nodered.org/t/need-some-help-with-a-varable-json/14210.md?page=1)
