Need Json response but I'm getting XML response from Scripted REST Resource

Ramesh68
Tera Contributor

Code Written in  Scripted REST Resource

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {


return 'xyz';
})(request, response);

 

response in web browser in Xml

 

<response>
<result>"yogi"</result>
</response>
 
How to get Json response
1 ACCEPTED SOLUTION

anyway if you really need to get the result on browser then pass that url as end point in rest message

you need to create rest message and pass the url in endpoint and it will show you the JSON

attaching the thread below will help you.

 

https://community.servicenow.com/community?id=community_blog&sys_id=209ceae1dbd0dbc01dcaf3231f961933

View solution in original post

11 REPLIES 11

download the boomerang, its chrome extension.

 

https://chrome.google.com/webstore/detail/boomerang-soap-rest-clien/eipdnjedkpcnlmmdfdkgfpljanehloah...

 

i am not sure why dont you write the code in background script. it will be more easy way to test your scripted api. is there any specific business need to test it on browser?

anyway if you really need to get the result on browser then pass that url as end point in rest message

you need to create rest message and pass the url in endpoint and it will show you the JSON

attaching the thread below will help you.

 

https://community.servicenow.com/community?id=community_blog&sys_id=209ceae1dbd0dbc01dcaf3231f961933