- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2018 01:42 PM
I have a scripted web service is is generating a JSON formatted string. When sent as the response it is being escaped. How can this be prevented?
Output when run in background script:
{"number": "INC0939032","short_description":"Title text","description":"Description text",....
Output from the REST service:
{\"number\":\"INC0832852\",\"short_description\":\"Title text\",\"description\":\"Description text",....
Requirement:
We need to supply a list of fields and all related comments from and Incident in a single JSON formatted response.
Any assistance will be appreciated.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2018 03:17 PM
try this .
var httpResp = JSON.stringify(JSON.parse(response.getBody()));
gs.log("REST httpResponse : " + httpResp);
-------------------------------------------------------------------------------------------------
*** Script: REST httpResponse : {"offsets":[{"partition":0,"offset":15938347,"error_code":null,"error":null},{"partition":0,"offset":
*Please mark as Helpful or Correct Answer if this was useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2018 11:32 AM
Found the simple answer here:
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_RESTAPIResponse-setBody_Object