Node Red Funtion node to generate random TTS speech makes google say "&#39" for every apostrophe

Hello, I used to use this for my Alexa TTS but the Google Cloud say seems to having some issues with punctuation and saying “#39” for every apostrophe.
Here’s the function node with the random text code

var beg = ["Pardon the interruption, ", "Bossman, ", "Sir, ", "Just a heads up, ", "Sir, I hate to bother you but, ",]

var mid = ["It's almost bed time,", "It's getting late,", "The time for sleep is near,"]

var end = ["and you'd better start winding down", "and the early bird gets the worm", "and you know you will want more sleep in the morning", "and getting a good nights sleep is always a good idea"]

msg.payload =

beg[Math.floor(Math.random() * beg.length)]+

mid[Math.floor(Math.random() * mid.length)]+

end[Math.floor(Math.random() * end.length)]

return msg 

It’s passing to a service call node for cloud say TTS
with data as

{
    "message": "{{payload}}"
}

Debug for the function node shows the text fine (Top), but the output for the cloud say node is changing all the apostrophes to “&#39” so that’s what google is saying…

Any ideas on how to fix this? I’m sure it’s something simple, but I can’t seem to figure it out. Used to work fine to Alexa TTS
I’ve basically created all kinds of random speech function nodes like this one over the years so switching to google has broken a lot of my TTS.

Thanks ya’ll!!!

try {{{payload}}} i.e. three open/close braces.

1 Like

Same behavior unfortunately.

Even with

{"message":"{{payload}}}"}

And I just realized the type I made during that test. I’ll have to try again here a bit later. I have people installing windows today and I’m sure they don’t want to hear Google talking to them out of nowhere lol.


[quote="35e, post:2, topic:460379, full:true"]
try `{{{payload}}}` i.e. three open/close braces.
[/quote]

Thanks so much!!! looks like 
`{"message":"{{{payload}}}"}` is working as intended, You rock my friend!!!