Multiline Input into HTML (to be passed in JSON)


Does anyone have a solution to have multiline input value converted into HTML so that it can be passed as a JSON string?

I experience an issue with passing multiline input value as JSON doesn’t process quotation makrs and line breaks (plus a pile of other symbols)

Would be grateful for any advice!


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.

Thank you!

Replacing line breaks and quotes does help, but there are other symbols that user can put into a multiple line input that causes a problem.

Is there a way to “wrap” all multiline input somehow so that it go through?

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.

It seems that the issue is caused only by the following symbols:

’ " \ < > and a line break (\n),

If all are replaced with HTML code (, all seem to work.

1 Like

Hello, sent you PM.

Heya - I am looking to do the same but from a html rich text input to json so I can pass it to Sendgrid. Any ideas on how to best solve this?

Hello Sir!

“Test for Error” manual method is what I use.

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).

Let me know how it goes.

Thank you - at the end I was able to just replace " with \" to get a good enough result when passing it as content using the Sendgrid api.

1 Like

Just a little discovery.

\ (backslash symbol) couses issues as much as "

So after a day of trying, I thing the following is the optimal way to go with this replacements:

1. Replace individual \ with two backslashes (result in email will be just , even here two backslashes aren’t displayed)

**2. Replace " with \" **

3. Replace \n with <br> (Regex needs to be ticked in this one)

Hope it will save many people a lot of time!



Is it possible to send rich text inputs via Sendgrid?

I´m trying it but I get a [br] … codes like the image below.

Thanks guys.



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.

Does this make sense?


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.

Any ideas?


1 Like

Wohoo :+1:

Thank you so much @funwtp

Worked like a charm.

Have a nice day.

1 Like

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.


thanks to this post originally:


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

1 Like

Found this tool helpful for non user-input usecases

1 Like

I specifically registered to tell you THANK YOU for this!