# More fun with message formatting

**URL:** <https://discourse.nodered.org/t/more-fun-with-message-formatting/79394>\
**Category:** General\
**Created:** [24 June 2023 21:15 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394 "2023-06-24T21:15:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 21:15 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/1 "2023-06-24T21:15:13Z")

</div>

Ok, to keep things separate:

I'm stuck now with a message I have made with a python3 script to make a JSON message.

The message as given is:

```auto
{"ssid": "Marys_Farm_2.4", "signal_level": "-72"}
{"ssid": "PiNet", "signal_level": "-70"}
{"ssid": "Optus_ABA172_5GHz", "signal_level": "-48"}
{"ssid": "Marys_Farm_5", "signal_level": "-55"}
{"ssid": "WiFi-AFB6", "signal_level": "-49"}
{"ssid": "TelstraCA5E31", "signal_level": "-64"}
{"ssid": "MyRepublic 49D9", "signal_level": "-63"}
{"ssid": "Optus_ABA172", "signal_level": "-76"}
{"ssid": "WiFi-F852-5G", "signal_level": "-68"}
{"ssid": "Aussie Broadband 4928", "signal_level": "-49"}
{"ssid": "\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00", "signal_level": "-58"}
{"ssid": "WiFi-F852", "signal_level": "-74"}
{"ssid": "WiFi-AFB6-5G", "signal_level": "-80"}
{"ssid": "WiFi-E987", "signal_level": "-72"}
{"ssid": "OPTUS_69E639M", "signal_level": "-82"}
{"ssid": "TelstraDDE916", "signal_level": "-85"}
{"ssid": "Not Your Wifi_Guest", "signal_level": "-84"}

```

And I am getting an error:

```auto
{"message":"Unexpected token { in JSON at position 50","source":{"id":"177e50e0152c6adc","type":"json","name":"WAP LIST JSON","count":1}}

```

Which after a bit of digging is (depending if the value is ZERO counting or not:  
The end of the first line of the start of the second.

As the error declared `{` I'm guessing the start of the second line.  
Ok, so (_again guessing_) there is a `,` missing between the first `{ }` and the second one.

I could maybe get the python code to stick a `,` at the end of the line but then when it gets to the end and sends the LAST line, a `,` would be stuck at the end of that, and I am sure that will throw a spanner in the works.

SORRY... I know this is python and this forum is Node Red.  
But I feel here I am better known and the answer/s may be better worded for me than if I am a complete _noob_ in a python forum and ask the same question.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 June 2023 21:19 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/2 "2023-06-24T21:19:12Z")

</div>

Your guess is correct. You need a comma between each object. AND you also need a [at the very start and a] at the very end of the last line in order to create a complete json array object that can then be parsed.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 21:21 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/3 "2023-06-24T21:21:35Z")

</div>

Thanks.

Alas that is above my skill set.

Drats!

I'll play around with it.

The first/last `[]` could be done with a `template` node - yes?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 June 2023 21:23 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/4 "2023-06-24T21:23:25Z")

</div>

It would be better to do it correctly in python to start with.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 21:24 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/5 "2023-06-24T21:24:29Z")

</div>

Yes, agreed. But as I said: That is a _beyond vertical_ curve just now.

I'll run off and see what I can learn ITMT.

Thanks.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 22:13 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/6 "2023-06-24T22:13:24Z")

</div>

(Sorry)

Searching and trying to understand.

Found this link [Write json into file Python 3 - Stack Overflow](https://stackoverflow.com/questions/55591341/write-json-into-file-python-3)

But in those examples the JSON parts are not separated with a `,`

They are just appended to one another - as I kind of have. (Ok, mine have a `\n` between them)

So I am missing something in the _structure_ I fear/feel.

Still looking - kind of.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 June 2023 22:21 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/7 "2023-06-24T22:21:25Z")

</div>

Ideally you would only send valid json. However, of this is all you have then in a function...

```auto
msg.payload = JSON.parse(`[${msg.payload.split('\n').join(',')}]`)
return msg

```

_untested_

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 23:40 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/8 "2023-06-24T23:40:05Z")

</div>

(Sorry for late/slow reply)

That's in a `function` node in NR - yes?

Just as DCJ said: Better to keep it all in python.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 June 2023 23:41 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/9 "2023-06-24T23:41:52Z")

</div>

> [@Trying\_to\_learn](#):
>
> That's in a `function` node in NR - yes

Yes:

> [@Steve-Mcl](#):
>
> in a function...

> [@Trying\_to\_learn](#):
>
> Just as DCJ said: Better to keep it all in python

As did I...

> [@Steve-Mcl](#):
>
> Ideally you would only send valid json

But I gave you an (untested) workaround

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 23:45 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/10 "2023-06-24T23:45:51Z")

</div>

I am not having a good time just now.

My parsing system is not as good as I would like.  
Sorry.

I'll see what happens.

But initial test gives me:

```auto
SyntaxError: Unexpected token , in JSON at position 3

```

I'll work on that and see what I can work out.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 June 2023 23:53 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/11 "2023-06-24T23:53:35Z")

</div>

Change it to this:

```auto
const json = `[${msg.payload.split('\n').join(',')}]`
node.warn({json})
msg.payload = JSON.parse(json)
return msg

```

[/quote]

What do you see?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 June 2023 23:57 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/12 "2023-06-24T23:57:45Z")

</div>

Just before I do that:  
(Not having a go at you)

I stuck some `debug` nodes in the code.

Going in is one big message.  
After that node it has split them into single messages.

(See below)

Going in:

```auto
{"ssid": "Marys_Farm_2.4", "signal_level": "-49"}
{"ssid": "Marys_Farm_5", "signal_level": "-53"}
{"ssid": "TelstraCA5E31", "signal_level": "-26"}
{"ssid": "PiNet", "signal_level": "-70"}
{"ssid": "Optus_ABA172_5GHz", "signal_level": "-80"}
{"ssid": "WiFi-E987", "signal_level": "-53"}
{"ssid": "\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00", "signal_level": "-48"}
{"ssid": "WiFi-AFB6", "signal_level": "-51"}
{"ssid": "Optus_ABA172", "signal_level": "-59"}
{"ssid": "WiFi-F852", "signal_level": "-64"}
{"ssid": "MyRepublic 49D9", "signal_level": "-75"}
{"ssid": "WiFi-AFB6-5G", "signal_level": "-85"}
{"ssid": "Madagascar", "signal_level": "-68"}
{"ssid": "Aussie Broadband 4928", "signal_level": "-87"}
{"ssid": "TelstraDDE916", "signal_level": "-66"}
{"ssid": "OPTUS_69E639M", "signal_level": "-83"}
{"ssid": "NetComm 4761", "signal_level": "-80"}

```

Coming out:

See picture.

 ![Screenshot from 2023-06-25 09-56-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/60371082bcccac578f8da832fc4b914c9759b808.png)

I am suspicious the `join` part is failing somehow/where.

# WITH YOUR NEW CODE

This is what I get:

```auto
[{"ssid": "Marys_Farm_2.4", "signal_level": "-48"},{"ssid": "Marys_Farm_5", "signal_level": "-53"},{"ssid": "TelstraCA5E31", "signal_level": "-21"},{"ssid": "PiNet", "signal_level": "-69"},{"ssid": "Optus_ABA172_5GHz", "signal_level": "-53"},{"ssid": "\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00", "signal_level": "-48"},{"ssid": "WiFi-AFB6", "signal_level": "-51"},{"ssid": "Optus_ABA172", "signal_level": "-68"},{"ssid": "MyRepublic 49D9", "signal_level": "-74"},{"ssid": "WiFi-AFB6-5G", "signal_level": "-67"},{"ssid": "Aussie Broadband 4928", "signal_level": "-60"},{"ssid": "WiFi-F852", "signal_level": "-64"},{"ssid": "WiFi-F852", "signal_level": "-80"}]

```

But it isn't JSON format. ☹ (I think)  
The output - when sent to the `chart` - does nothing/nothing is shown.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 June 2023 00:35 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/13 "2023-06-25T00:35:38Z")

</div>

> [@Trying\_to\_learn](#):
>
> But it isn't JSON format. ☹ (I think)

It is valid json.

 ![Screenshot_20230625-013446](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d19cb97e7a633316e23a0e039de7f8d5bd7623b3.png)

Check for yourself: [https://jsonlint.com/](https://jsonlint.com/)

Actually, if you look at your debug, you can see it has been parsed to a js array of objects. But then you run it through JSON node again - that turns it back into a string.

In short, delete the JSON node.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [25 June 2023 00:40 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/14 "2023-06-25T00:40:53Z")

</div>

Sorry Steve. I do accept your reply as valid.

But I only added the second JSON node because the `debug` node wasn't showing it in the style I understand as valid JSON.

(Hang on while I test it)

This is what I get/see.

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

But if I go to the `chart` node.....

Blank.

I'll stick the spare `debug` node after the `change` node.  
Hang on. (again) 🙂

This is what I get:

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

`undefined`

Code:

```auto
[{"id":"5857cdacd0e8c87a","type":"function","z":"2eb377ce0b03a7d9","name":"function 9","func":"const json = `[${msg.payload.split('\\n').join(',')}]`\nnode.warn({ json })\nmsg.payload = JSON.parse(json)\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":240,"y":300,"wires":[["6bbb8da9ee9f8f2a","04a6910f87afe4ca","177e50e0152c6adc"]]},{"id":"177e50e0152c6adc","type":"json","z":"2eb377ce0b03a7d9","name":"WAP LIST JSON","property":"payload","action":"","pretty":false,"x":450,"y":300,"wires":[["48ee756e1ec0c783","f09abc35ef453f9c"]]},{"id":"f09abc35ef453f9c","type":"change","z":"2eb377ce0b03a7d9","name":"","rules":[{"t":"move","p":"payload.ssid","pt":"msg","to":"topic","tot":"msg"},{"t":"move","p":"payload.signal_level","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":330,"wires":[["a5f43014722527f0","153c6bc8ba3c1a80"]]},{"id":"a5f43014722527f0","type":"ui_chart","z":"2eb377ce0b03a7d9","name":"","group":"bcfab13aa8c1ed64","order":0,"width":"8","height":"10","label":"chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"30","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":880,"y":300,"wires":[[]]},{"id":"bcfab13aa8c1ed64","type":"ui_group","name":"Group 1","tab":"1bc896de46b4f98a","order":1,"disp":true,"width":"10","collapse":false},{"id":"1bc896de46b4f98a","type":"ui_tab","name":"WAP list","icon":"dashboard","order":10,"disabled":false,"hidden":false}]

```

That I am getting `undefined` from that `debug` node _implies_ to me that the _structure_ is not valid in the message.

🤷

---

<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:** [25 June 2023 12:08 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/15 "2023-06-25T12:08:55Z")

</div>

As (I think) everyone has agreed, it is best to fix any message format problems at source, so I have taken another look at the Python script you posted in the other thread.  
Here is the script as I modified it, with comments to explain the change.  
Essentially I'm making a Python dictionary for each access point then adding it to an array.

```auto
#! /usr/bin/python
import json
import subprocess
import re

def scan_wifi():
    # Run the iwlist command to scan for wireless networks
    cmd = subprocess.Popen(['sudo', 'iwlist', 'wlan0', 'scan'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output, _ = cmd.communicate()

    # Decode the output from bytes to string
    output = output.decode()

    # Extract the relevant information using regular expressions
    networks = re.findall(r'ESSID:"(.*?)".*?Frequency:(.*?)\s.*?Signal level=(.*?)\s', output, re.DOTALL)

    # Return the list of networks
    return networks

wifi_networks = scan_wifi()
myarray = [] # The output should be an array of js objects, so make an empty array
for network in wifi_networks:
    ssid = network[0]
    frequency = network[1]
    signal_level = float(network[2]) # Take the opportunity to have signal level as a number not string
    dict = {"ssid": ssid, "signal_level": signal_level} # Make it a Python dictionary {name:value, name:value}
    myarray.append(dict) # Add it to the array

output = json.dumps(myarray) # Finally output as json string
print (output)

```

This is the slightly modified flow to call the script and process it

 ![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7c8e359bbc45e238334fbc953b9999802e77d1c3.jpeg)

```auto
[{"id":"77b306137df5482d","type":"ui_chart","z":"4f02d48c1fd987a5","name":"","group":"04d86d5dc7122996","order":2,"width":0,"height":0,"label":"chart","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":890,"y":500,"wires":[[]]},{"id":"f11072b8baee6804","type":"exec","z":"4f02d48c1fd987a5","command":"/home/pi/foo","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":270,"y":420,"wires":[["7a6ec66b4a5acd27"],[],[]]},{"id":"867be5fe367ced2f","type":"inject","z":"4f02d48c1fd987a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":420,"wires":[["f11072b8baee6804"]]},{"id":"a33eafdd94fae24a","type":"inject","z":"4f02d48c1fd987a5","name":"empty array to clear chart","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":150,"y":500,"wires":[["77b306137df5482d"]]},{"id":"7a6ec66b4a5acd27","type":"json","z":"4f02d48c1fd987a5","name":"","property":"payload","action":"","pretty":false,"x":410,"y":420,"wires":[["3f36a9d814642f40"]]},{"id":"3f36a9d814642f40","type":"split","z":"4f02d48c1fd987a5","name":"Split on comma","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":560,"y":420,"wires":[["fefa2028f47708e6"]]},{"id":"fefa2028f47708e6","type":"change","z":"4f02d48c1fd987a5","name":"payload, topic","rules":[{"t":"move","p":"payload.ssid","pt":"msg","to":"topic","tot":"msg"},{"t":"move","p":"payload.signal_level","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":420,"wires":[["048800b73d1a39f5"]]},{"id":"048800b73d1a39f5","type":"switch","z":"4f02d48c1fd987a5","name":"","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"TALKTALK","vt":"str"},{"t":"cont","v":"BT-","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":420,"wires":[["77b306137df5482d"],["77b306137df5482d"]]},{"id":"04d86d5dc7122996","type":"ui_group","name":"Default","tab":"f3a8a67ff0904e39","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"f3a8a67ff0904e39","type":"ui_tab","name":"HOME","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

```

My script is /home/pi/foo. Not a wise choice of name but it's experimental. And I'm calling it via the exec node. I think you are using a pythonshell node. I assume it's much the same.

I have to pass the returned string through a json node because exec only returns a string.

I split on commas not new lines because it's now a proper json object.

Setup payload and topic for the chart same as you.

I'm using a switch node to filter out just a few SSIDs for clarity.  
Note that there are some accesspoints with blank or weird SSIDs which really mess up the chart, so this switch plays an important role.

Here is an example of the chart

 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/3/d394dc055ac8c7daa5fecb37c211397ffb114084.jpeg)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 June 2023 05:14 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/16 "2023-06-26T05:14:05Z")

</div>

I love it. @jbudd

Thanks for the effort/time you put in.

Yes, I am slightly _suspicious_ of some of the WAP names I see. But that's life.

That is really good.

Quickie:  
How did you get the round lines on the chart? (_bezier_?)  
I am on NR 3.0.2

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 June 2023 05:54 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/17 "2023-06-26T05:54:12Z")

</div>

That's an easy one to answer - select 'bezier' on the Interpolate option on the Chart node.  
 ![chart_option](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bbb6f5aafb52cf9ea6f943d43949969419e072d6.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 June 2023 05:55 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/18 "2023-06-26T05:55:17Z")

</div>

Thanks.

I've never used that before.

(OH and sorry.....)

Can I add more colours to the `chart` node?  
`9` isn't quite cutting it.

---

<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:** [26 June 2023 07:04 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/19 "2023-06-26T07:04:08Z")

</div>

There are 24 (?) more colours specified somewhere in the background.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [26 June 2023 07:07 UTC](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394/20 "2023-06-26T07:07:46Z")

</div>

Sorry, but when I open the `chart` node I only see 9 colours.

(I'm brain dead just now).

 ![Screenshot from 2023-06-26 17-05-50](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/07ea7eb9d9830aa862208065b6e960c2ae4cf403.png)

[Next page](https://discourse.nodered.org/t/more-fun-with-message-formatting/79394.md?page=2)
