Skip to main content

Hi, 

I’m trying to set up a event action. I call a REST endpoint from my event action.

I try to format my POSTed message as json. How can invalid characters, like {} “, in my data be handled? Is there a function for escaping texts?

Thank you!

Hi @ErikZ 

 

curly braces don’t need to escape in json payload. Double quotes can be escaped with \. do you have an example message with invalid characters?

 

Cheers!

Damith


Hi @dsj,

the body defined for my POST looks like this,

{"tasknr" :"&OLD:TASK_SEQ", "descr" : "&NEW:DESCRIPTION"}

If description contains double quotes then the json is not valid I suppose. Is there a function I can use to escape NEW:DESCRIPTION?


Have you tried the Oracle REPLACE function

Eg:

select REPLACE ('My text with "doublequotes"', '"', '\"') from dual

 

Haven’t tested below but hope it works :) 

json_ := '{"tasknr" :"&OLD:TASK_SEQ", "descr" : "' || REPLACE(&NEW:DESCRIPTION, '"', '\"') || '"}';

 

/Damith


Reply