Reputation: 385
Suppose my response object is of form:
[
{ id:"id1",
name: "name1"
},
{ id:"id2",
name: "name2"
},
{ id:"id3",
name: "name3"
}
]
And i want to only validate on Ids received , how do i extract that from response?
I have tried
* def filt = function(x){ return x.id }
* def items = get response[*]
* def ids = karate.filter(items, filt)
But this gives me empty array for Ids
Upvotes: 1
Views: 1332
Reputation: 385
I was able to get this resolved using
* def items = get response[*]
* def ids = $items[*].id
Upvotes: 1