Manage REST Message response (getBody())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2018 11:33 AM
I would need to derive, starting from the body of a response to a REST call {responseBody = response.getBody ();} the amount of rows, and extract single field arrays in order to populate a table.
I saw on the Documentation that the getBody () method returns a string, whose syntax, however, is like a JSON.
How can I solve?
Thank you ☺

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2018 11:52 AM
Hi Leo,
You are correct, I believe it is JSON. Here is an example of how to use it from some of the OOB code to parse the response back into an object:
var responseBody = response.getBody();
var parser = new JSONParser();
var parsed = parser.parse(responseBody);
This is from the (OOB) GoogleCaptcha script include. Let us know if you have more questions.
Thanks,
-Brian