JSON / REST special character problems: a solution

use base64 encoding and decoding to get around it


  • in the REST message (outbound request): 


var wnotes_base64Encode=GlideStringUtil.base64Encode(worknote);

...
r.setStringParameter('u_work_notes', wn_base64encoded);



  • in the counterpart REST endpoint code (ServiceNow example) (incoming): 

                 
var sdesc_base64Decoded=GlideStringUtil.base64Decode(wnotes_base64Encode);

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue