Intro to JSON for Node-RED video

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

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.

3 Likes

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).

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?

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

{"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

let someJSON = `"a string"`

or

let someJSON = "\"a string\""

See https://www.json.org/json-en.html

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.

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

image

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