retrieve field from response.getBody()

Amol J
Kilo Contributor

Hi,

I am setting the data in following way

user.push({
'role':roles
});

 

and receiving it through REST api 

var response = request.execute();

var res = response.getBody();

it is giving me complete object see below

find_real_file.png

I want to get roles from this array How can I achieve this?

6 REPLIES 6

use gs.log() 

 

gs.log('Value is '+ot.result[i].role);

while setting add the below changes

return JSON.stringify(user);