# Intro to JSON for Node-RED video

**URL:** <https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997>\
**Category:** General\
**Created:** [17 March 2022 16:02 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997 "2022-03-17T16:02:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thebaldgeek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thebaldgeek/32/93523_2.png) [@thebaldgeek](https://discourse.nodered.org/u/thebaldgeek)\
**Post date:** [17 March 2022 16:02 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/1 "2022-03-17T16:02:12Z")

</div>

Little bit of a proud Dad moment here... and also a little ashamed...  
My son has just finished off his latest Node-RED video.

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a9f33c2b4d153de0695d9829597e4c9d47ab11c.jpeg "Intro to JSON for Node-RED") ](https://www.youtube.com/watch?v=pbzwYKbGPC4)

He wrote the script after seeing me struggle to build a JSON payload in a function node for the ui-table node.

Right this very second, he's in our company studio recording a video on using the table node, also as a result of my struggles.

Hope it helps someone else out.

---

<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 March 2022 16:28 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/2 "2022-03-17T16:28:39Z")

</div>

Excellent work. I don't have time to watch the full video at the moment, does he cover the fact that the JSON text could consist of an array, not an object? Or, in fact, just a number, true/false or a string (in double quotes).

---

<div class="post-metadata">

**Author:** ![thebaldgeek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thebaldgeek/32/93523_2.png) [@thebaldgeek](https://discourse.nodered.org/u/thebaldgeek)\
**Post date:** [17 March 2022 16:44 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/3 "2022-03-17T16:44:08Z")

</div>

I guess I need to watch the video again (for the 20th+ time) as I don't follow your question.  
He shows a null and Boolean and how you can put objects inside the object.  
Is that what you mean?

---

<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 March 2022 16:51 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/4 "2022-03-17T16:51:39Z")

</div>

Not quite. These are all (individually) valid JSON text.

```auto
{"name": 7}
[7,3,"hello"]
"a string"
7
true
false

```

Note that in the case of `"a string"` the quotes have to be there inside the string, so in javascript

```auto
let someJSON = `"a string"`

```

or

```auto
let someJSON = "\"a string\""

```

See [https://www.json.org/json-en.html](https://www.json.org/json-en.html)

---

<div class="post-metadata">

**Author:** ![thebaldgeek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thebaldgeek/32/93523_2.png) [@thebaldgeek](https://discourse.nodered.org/u/thebaldgeek)\
**Post date:** [17 March 2022 16:54 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/5 "2022-03-17T16:54:07Z")

</div>

Ah. Ok.  
In that case, this video is not for you.... Its hard to be all things to all people. We had to draw a line in the sand somewhere.

---

<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 March 2022 17:15 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/6 "2022-03-17T17:15:02Z")

</div>

The use case of an array is quite common (the others less so). This can be used to inject an array for example.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b9a36876c294672c03c671b285542e484e7128e.png)

---

<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 May 2022 17:15 UTC](https://discourse.nodered.org/t/intro-to-json-for-node-red-video/59997/7 "2022-05-16T17:15:16Z")

</div>

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