Published on InterSystems Developer Community (https://community.intersystems.com)

Home > How to remove escape characters from JSON

Question
Julie Marulappa · Apr 18, 2019

How to remove escape characters from JSON

I am still new to cache objectscript and am trying to figure out how I would go about removing the escape characters from my JSON below. When I call the $toJSON method it's adding the "\" character in the file path.

 

{"FileStatus":"P","Path":"\/somepath\/test\/test123\/filename.txt","InterchangeOID":"100458"}

My Code:

set tJSONFile = {"FileStatus":pRequest.FileStatus,"Path":pRequest.Path,"InterchangeOID":pRequest.InterchangeOID}

set tJSONFile = tJSONFile.$toJSON()

Thanks.

#JSON #ObjectScript #Caché

Source URL:https://community.intersystems.com/post/how-remove-escape-characters-json