It is pretty straight forward to to get a value of a key from json response in postman say :
pm.test("AddCluster", function () {
var jsonData = pm.response.json();
pm.globals.set("taskIdCluster", jsonData.value);
});
For JSON Response
{
"value": "task-1405"
}
I am not able to extract json value in the below case where key has a '.' as part of its string.Can any one help me with this.
"result": {
"cluster.moid": "domain-c433242"
}
I tried the following below code:
pm.test("abc", function () {
var jsonData = pm.response.json();
var result = jsonData.result;
var moid = result.'cluster.moid' ;
pm.environment.set("clusterMoid", moid);
});