How to escape double quotes in a JSON?

Smith Johnson
Tera Guru

Hi community,

I have the following field where the user can insert any character. For example:

find_real_file.png

Then, behind the scenes once the form is submitted, a script include makes a REST API call.
However, the double quotes that the user inserted make the integration fail.

The request body looks like this:

find_real_file.png

Any ideas on how to solve this??

 

Thank you in advance,

Smith.

1 ACCEPTED SOLUTION

use to \\ to escape

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

11 REPLIES 11

Hi Ankur, 

 

thanks for you response.

Following your instructions now the integration does not fail. The request looks like this:

find_real_file.png

However, do you think that the third system (I do not have access to test it), will able to read the description without the \ character ??? 

@Smith Johnson 

Glad to know that my approach worked and error is resolved.

tell the 3rd party system to handle that at their end

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader