This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How do replace carriage returns (newlines) in one of my variables in an alert action to make it JSON compliant?

I'm sending JSON in one of my alert actions to a REST API.

I've formatted the JSON and I'm also using variables (like ${N=Alerting;M=Notes} ).

Unfortunately, the Alert Notes variable value has some unsafe JSON characters in it (namely, carriage returns).  My REST API is giving me these errors from time to time:

There was an error when trying to parse the webhook body to JSON (could be due to un-escaped control characters like newlines):
Illegal unquoted character ((CTRL-CHAR, code 9)): has to be escaped using backslash to be included in string value at [Source: (ByteArrayInputStream); line: 3, column: 422] (through reference chain: com.codebarrel.automation.api.webhook.IncomingWebhook["Description"])
I'm stumped on how I can replace the newline character embedded in the ${N=Alerting;M=Notes} value?  Is there a built in replace function?
Thank you~!