Postman: How to check the data type of each value in a response
This should do the check for you:
pm.test('Not contain numbers', () => {
var jsonData = pm.response.json()
for (i = 0; i < jsonData.teamPermissions.length; i++) {
pm.expect(jsonData.teamPermissions[i]).to.not.be.a('number')
}
})
Here's what the check will do if a number is part of the array, I've logged out the types so you can see what it's checking against.
Another alternative is to use Lodash, it's a build-in module for the Postman native app. This code will run the same check as the one above:
pm.test('Not contain numbers', () => {
_.each(pm.response.json().teamPermissions, (arrItem) => {
pm.expect(arrItem).to.not.be.a('number')
})
})