I am trying to retrieve an index by passing a reference of a value.
I have some options of javascript but all those functions shows is not a function
Getting error like below:
TypeError | jsonData.getIndexOf is not a function
I have tried options mentioned in below link:
get index from a JSON object with value
Example:
var jsonData = JSON.parse(responseBody);
Array.prototype.getIndexOf = function(el) {
var arr = this;
for (var i=0; i<arr.length; i++){
console.log(arr[i].name);
if(arr[i].name==el){
return i;
}
}
return -1;
}
console.log(jsonData.getIndexOf("Volume"));
Object screenshot:
Is it possible in postman/newman