I can't convert text to lowercase

Well - the gremlins are really mucking me up today

Tried using Blocky node to convert payload to lowercase - get error

Tried using a contrib node - got error

Tried using JSONata - got error

Will someone please just give me some working code!!!! #LOL

An example flow with the text would be helpful, but the JSONata would be


and Javascript

msg.payload = msg.payload.toLowerCase()
return msg;

I use a String Node to do that.


I feel I've completely lost the ability to use NR this morning! :frowning:

What is that string node?

Are you saying you are still getting errors, if so export an example flow please.

Tried a simple test one and that worked so investigating why it doesn't work in the real flow

Sorry, I thought it was included in the standard Node Red installation. I was wrong.

You can find it here: node-red-contrib-string (node) - Node-RED

It does all sorts of text manipulation. For example, I use it to manipulate the HTML file of another node.
After getting the HTML text of the node, the String Node performs a Find & Replace for the hex string of the background color of the node. The flow then re-saves the node's HTML file. This changes the background color for the node from what the developer has setup.

It probably has 30+ different ways to manipulate a text string

1 Like

How is "red" generated?

Standdown everyone :slight_smile:

So I had a switch node (this is a flow that has been working for a long time) but needed to now make it's input into lowercase

What I hadn't realised was that it was working on msg.payload.status not msg.payload so that is why everything was failing on me when trying to convert an object to lowercase

And unfortunately, the error messages didn't provide a clue to this :slight_smile:


1 Like

I use Node Red so I don't have to learn JSONata or Javascript. :slight_smile:

1 Like

I needed a quick solution so I was up for anything that would have worked!

That contib node is the node for the job :slight_smile:

The cognitive bias to remain ignorant to other code and ways is not an enlightened approach.

You could simply use a simple JSONata expression in the switch node property. Not that difficult to learn or understand. and makes the flow shorter and adds no more complexity in my opinion.

I think the key phrase is "in my opinion" :slight_smile:

It is very good for getting around missing core features but unless people use it a lot, it's syntax can easily trip people up

Your the forums leading JSONata expert so it is easy for you :slight_smile:

Some people (like myself) are always looking for no-text-code solutions wherever possible :slight_smile:

I do you use one JSONata expression a lot as the no-code workaround, for the missing "not contains" in the switch node, just causes messy wiring


But I always have to find an existing one and cut and paste it as I forget the syntax of it :frowning:

  1. No, not the key pharse. just politeness as to mitigate some offense that may be taken.
  2. Simple JSONata and Javascript expression, are really not that difficult, but if you never try you will never improve. Mistakes are a learning tool/lesson.
  3. Not really, but do have a keen understanding of it's nuances. This came from trial and error.
  4. You are free to make any choices you like in this world. They may turn out not be the best choices however. You are still free to make them.

I'm not going to argue with 1,2 and 3 as we'd be here all day :slight_smile:

But 3 IS true :slight_smile: You ARE the forums leading JSONata expert :slight_smile:

For which we are all grateful for :slight_smile:

There are others not so vocal that would out shine me, I am the most prolific.

Enjoy the rest of the your weekend, as as you say we could discuss points to Ad Nauseam

1 Like

Not to start a philosophical argument but I am going to have a different opinion here. Node Red was created as a graphical tool. Therefore, if the Node Red folks or community developer has created a node that will do the job that would otherwise require JSONata or Javascript, why not use it? To take it to the extreme, I don't need to know the language that Microsoft Word was written to compose a letter.

This is my opinion. :grin:

1 Like

You can choose to do things anyway you wish, i am not arguing that.

I simple state that to choose to not look at other ways in not an enlightened approach.

:joy: :rofl: :joy: :rofl:
I'm glad I'm not the only one who does this! I may, however, hold the record for how often! We'll never know because I have nothing more to say on the subject.