How to extract value from body of returned REST Call
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2024 07:37 AM
We have a REST Call that returns this response:
Account Disabled { "data": {}, "message": "Successful - User has been suspended and accounts disabled.", "status_code": 200 }
The message value will not always be the same, so we want to only display what the value in the message is. Please could someone provide a script on how to strip out the message value from the response.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2024 09:22 AM
Hi @bpolo,
You'll want something along the lines of the below:
//Sample JSON:
var responseBody = { "data": {}, "message": "Successful - User has been suspended and accounts disabled.", "status_code": 200 }; //Update this to point to your JSON payload here
//Code:
var message = JSON.stringify(responseBody.message);
gs.print("Message : " + message);
//Result:
//***Script: Message: Successful - User has been suspended and accounts disabled.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 08:17 AM
Thanks very much, Robbie! This was very helpful!
The only piece I had to add was
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2024 11:03 AM
No worries at all @bpolo.
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie