"Data types". Stuck getting data formatted correctly


I'm just not understanding something.

I need to display a simple set of variables in/on a table.
I found this:
Simple One dimensional array.
and it works as given.
But it takes numbers. But anyway....

The array is rather simple to see/understand.

var arr =[67.4, 69.5, 72.5, 67.8, 65.0];
msg.payload = arr;
return msg;

I want to display this packet in the table.
(I hacked the code and replaced the first line with the data and it works. So that establishes it can be done.)

This is what I want to display. From a debug node:

{"topic":"STATUS/WAP/","payload":"[\"TPG-VZBS\", \"Chilli\", \"Tango2\", \"Telstra6C2C0D\", \"WiFi-DFFA\", \"BigPond121C\", \"\", \"NetComm Wireless 2\", \"Fon WiFi\", \"TelstraCCBDD1\"]","qos":2,"retain":false,"_msgid":"6430ff14.59fd3"}

To me I see the msg.paylaod as:

["TPG-VZBS", "Chilli", "Tango2", "Telstra6C2C0D", "WiFi-DFFA", "BigPond121C", "", "NetComm Wireless 2", "Fon WiFi", "TelstraCCBDD1"]

Which is exactly the same format is the example line.

It doesn't work.

Though in the debug node there is a leading " and trailing " which I had a devil of a time trying to get rid of.

All to no luck.

This is the code I made to explain what I want to do:

[{"id":"c752e59.3bf8298","type":"inject","z":"cb1ffcc6.d23ba8","name":"Go","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":2010,"wires":[["9369258f.72477"]]},{"id":"9369258f.72477","type":"function","z":"cb1ffcc6.d23ba8","name":"build array (1)","func":"var arr =[67.4, 69.5, 72.5, 67.8, 65.0];\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":2010,"wires":[["43f6ae6f.f5996","2c1e790e.62606e"]]},{"id":"eb665419.25463","type":"inject","z":"cb1ffcc6.d23ba8","name":"Go","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"","x":110,"y":2060,"wires":[["1e7c9821.2b5c4"]]},{"id":"1e7c9821.2b5c4","type":"function","z":"cb1ffcc6.d23ba8","name":"build array (1)","func":"var arr =[\"TPG-VZBS\", \"Chilli\", \"Tango2\", \"Telstra6C2C0D\", \"\", \"BigPond121C\", \"Modem of joy\", \"NetComm Wireless 2\", \"Fon WiFi\", \"TelstraCCBDD1\"];\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":2060,"wires":[["43f6ae6f.f5996","2c1e790e.62606e"]]},{"id":"43f6ae6f.f5996","type":"ui_template","z":"cb1ffcc6.d23ba8","group":"93ff74eb.94d69","name":"One dimension array table USE THIS ONE","order":1,"width":"6","height":"6","format":"<table id=\"table\" border=\"1\">\n <tr>\n <th>Something</th> \n </tr>\n <tbody>\n <tr ng-repeat=\"row in msg.payload\">\n <td class=\"text\" >{{row}}</td>\n </tr>\n </tbody>\n</table>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":600,"y":2010,"wires":[["6abb88fe.9dddb8"]]},{"id":"93ff74eb.94d69","type":"ui_group","z":"","name":"One dimension Array","tab":"9c6bae0.3b358d","order":1,"disp":true,"width":"6","collapse":false},{"id":"9c6bae0.3b358d","type":"ui_tab","z":"","name":"Table Examples","icon":"dashboard","order":1}]

That works as is.

But if I get the extra part:

[{"id":"e2878e.e5d7287","type":"mqtt in","z":"cb1ffcc6.d23ba8","name":"","topic":"STATUS/WAP/#","qos":"2","broker":"8a2e80be.f7c928","x":120,"y":1780,"wires":[["c8dbfab6.c46d3","6ca5d58d.cb0124","19549fd7.1a41f8"]]},{"id":"6ca5d58d.cb0124","type":"string","z":"cb1ffcc6.d23ba8","name":"","methods":[{"name":"delLeftMost","params":[{"type":"str","value":"\""}]},{"name":"delRightMost","params":[{"type":"str","value":"\""}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":100,"y":1840,"wires":[["61112fdc.900548","2faad05c.3ebf7"]]},{"id":"2faad05c.3ebf7","type":"function","z":"cb1ffcc6.d23ba8","name":"","func":"var x = '[ ' + msg.payload + ' ]';\nmsg.payload = x;\nreturn msg;\n","outputs":1,"noerr":0,"x":290,"y":1880,"wires":[["e6014a54.116168","43f6ae6f.f5996"]]},{"id":"43f6ae6f.f5996","type":"ui_template","z":"cb1ffcc6.d23ba8","group":"93ff74eb.94d69","name":"One dimension array table USE THIS ONE","order":1,"width":"6","height":"6","format":"<table id=\"table\" border=\"1\">\n <tr>\n <th>Something</th> \n </tr>\n <tbody>\n <tr ng-repeat=\"row in msg.payload\">\n <td class=\"text\" >{{row}}</td>\n </tr>\n </tbody>\n</table>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":600,"y":2010,"wires":[["6abb88fe.9dddb8"]]},{"id":"8a2e80be.f7c928","type":"mqtt-broker","z":"","name":"MQTT host","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"ARDUINO_STATUS","birthQos":"2","birthPayload":"connected","willTopic":"ARDUINO_STATUS","willQos":"2","willPayload":"disconnected"},{"id":"93ff74eb.94d69","type":"ui_group","z":"","name":"One dimension Array","tab":"9c6bae0.3b358d","order":1,"disp":true,"width":"6","collapse":false},{"id":"9c6bae0.3b358d","type":"ui_tab","z":"","name":"Table Examples","icon":"dashboard","order":1}]

(You can see the overlap)

It doesn't work when the packet arrives.

The string node is there to try and fix up the formatting, but it really isn't working.


Yes. I know I have asked about this sort of stuff before.
I do want to understand it. But, for what ever reason, I am simply not understanding it.

I've been called up a few times (and I don't mind) about my "text formatting" and how I sometimes over do it with capitols, italics, etc etc.

I admit, that is a corrupt way of doing it. But it is something like how I was shown back in the day.

Nowadays, the style of markup blows my mind. To me it is gibberish.

I have to read things about 4 times before they even start to make sense. So when I read some stuff I am completely out of my depth.

Sure: That's how it is. Like it or lump it. But I don't really subscribe to that mentality.
We are all different. Because someone things differently doen't mean they are wrong. They are simply different.

So, I would like some help with understanding what I am not understanding, and please believe me when I say I don't like asking for help like this.
I get that I should be able to work it out for myself. I can sit there for hours repeating the example.

THERE AND THEN, it makes sense.

Next time...... It doesn't.

That's who I am.
And I have to live with this condition every hour of every day, all my life.



The extra quotes when displayed in Debug tells you that msg.payload is a String. Its a piece of text that looks like an array of strings.

In your flow you need an actual array of strings, not a piece of text that looks like one.

You can get rid of the String node you've added and replace it with a JSON node. The JSON node will take the msg.payload that is a string that looks like an array and convert it to the actual array object.



Ah! That's right!

json node!

Now I remember. And I know that will sound cheesy or cliche, but......

Again: Thanks.