Remove line breaks from a string (in JSON)

Hello to all!

I made a workflow with the openAi API in several steps. But the returned text contains line breaks and so if I reuse this string for the input after n8n I get an error.

So I want to add a function after each text generation to remove all line breaks. Does anyone have a function node to do this?

If any of you have already made a workflow with several calls to the openAi API and you have another solution, I’m interested!

Thanks in advance! Good day to all

1 Like

Hi @albaninho

This might help.

1 Like

Thank you @mcnaveen !

1 Like

Glad it helps, Enjoy! :tada: