Webhook to HTTP with newlines in JSON

Hi all,

I’ve got JSON coming in to a webhook in the following format

{
	"content": "Text text text.\n\nMore text:\n\n\n\nFinal text",
	"other_property": "other_value",
       ...
}

And I’m trying to get that content field sent to another API via the Http module.

But the \n characters keep getting replaced by newlines, which then break the endpoint I’m calling, who are expecting \n instead of actual newlines.

How can I retain the \n as they are, without being turned into actual newlines?

Your help is much appreciated!

Regards,
Andy

Hi @Andrew_Peacock

Providing “\\n” instead of “\n” will preserve the original “\n” characters as they are. If manual alteration of the structure is feasible, you can implement this change; otherwise, you can replace \n as \\n with replace function in the next step.
for example:

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

1 Like