json - Postman Get Request Set Environment Variable -


i have get request in postman. trying set environment variable objectid response body.

here response body fine.

{    "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryobjects/microsoft.directoryservices.user",      "value": [      {          "odata.type": "microsoft.directoryservices.user",          "objecttype": "user",          "objectid": "0fjrkfkfc-50b1-4259-a778-sjvmfgr5bhjj",              }         ] } 

i have tried following save objectid environment variable not working. appreciated.

var jsondata = json.parse(responsebody); postman.setenvironmentvariable("testtoken", jsondata.value[1]);  // returns [object object] postman.setenvironmentvariable("testtoken", jsondata.odata.metadata); // returns [object object] postman.setenvironmentvariable("testtoken", jsondata.value);  // returns [object object],[object object],[object object], etc. postman.setenvironmentvariable("testtoken", jsondata.odata.metadata.value);  // returns nothing postman.setenvironmentvariable("testtoken", jsondata.odata.metadata.value.objectid);  // returns nothing 

you got :)

jsondata.value[1].objectid should work.

jsondata.value return array containing single element - object keys odata.type, objecttype , objectid.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -