Best answer

How to remove line breaks for a JSON request?

  • 26 May 2020
  • 1 reply
  • 3711 views

Hi folks,

 

I am reading a Google sheets cell content into a custom POST request (Webhooks by Zapier). The problem is that I the input has several line breaks, which is not allowed in the JSON file. Is there any way to get rid of the line breaks or format the input with Zapier, so it won’t break the call?

 

"metadata": {

"body": "MEMBER_TO_MEMBER <br> Nachricht: "<p>Hi Tobias,

vielen Dank für deine Rückmeldung. Der 17. Juni klingt super, habe es mir im Kalender notiert. Unter welcher Nummer kann ich dich am besten erreichen?

Einen schönen und erholsamen Urlaub wünsche ich dir und wir hören uns dann im Juni.

Liebe Grüße

Luisa</p>"

}

icon

Best answer by Danvers 28 May 2020, 14:05

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +12

Hi @LuisaFromCasana, welcome to the Community!

 

Are the line breaks in the information from the cell in Google Sheets? If so, then you can remove those using a Formatter step. Add a step between the Google Sheets step and the Webhooks step and choose the Formatter by Zapier app. 

Select the option to work with text and then for the Transform field, choose ‘Replace’

 

For the input, add the information from Google Sheets

For the find field, what you need to use depends on how the text is formatted in Google Sheets:

  • [:newline:] - for  (\n) characters
  • [:return:] - for carriage-return (\r) characters

Then leave the ‘Replace’ field blank to remove any of those characters.

 

Finally, in your Webhooks step make sure you use the output of the Formatter step, rather than the original Google Sheets information.