It sounds like you’re passing values to javascript, using the HTML element?
You need to “escape” the backslashes and quotes (single or double, depending which you are using as a delimiter), by adding a backslash before them. And replace newlines with \n
You can do this with the :replace function. Either chain a few replace functions together, or use a regular expression.
Once its in a javascript variable, you can use more expressive regex in javascript to replace anything else. I didn’t think JSON had a problem with other symbols?
Edit: oops yes things like double quotes, curly braces, square braces.
I understand, rich text kinda already turns things into HTML likeable format, so try stating from replacing the following
’ " \ < > and a line break (\n),
and then replace any other weird looking symbols.
NB: Keep in mind Senfgrid now uses new form for substitution variables. In order to force Sendgrid to display your HTML nicely, put these variable in {{{ }}} (triple!!! each side).
Say you want to pass <*X>BOLD TEXT</*X> (this is HTML, replace *X with “strong”), and say you pass it as substitution variable called VAR1 (for example).
So, your SendGrid Template must have {{{VAR}}} in triple fanny brackets. These brackets make SendGrid recognise HTML.
Thanks for the reply. I actually solved the formatting with the “find and replace”. Also for this to work I had to create a “substitution tag” for the body of the email in Bubble.
Now the problem is that line breaks of the rich text does not work.
Just had fun with this one all day – if you’re having issues with new line breaks (“\n”) messing up your JSON formatting a Find&Replace using this regex might do the trick.
This also works for sendinblue by the way. I looked for days how to turn a multiline input to an html message body. On the workflow end, I just added the multiline input’s value:findandreplace with this regex pattern, replaced by