Check response dont have this id

hey guys im new in postman

this is my response

"status": "ok",

"statusCode": "0000",

"message": {

    "text": "",

    "type": ""


"errors": [],

"data": {

    "docs": [


            "name": "admin",

            "description": "نقش admin کل سیستم. با دسترسی به همه‌ی بخش ها (System generated)",

            "code": "T11AsR",

            "permissions": [
























            "protected": true,

            "userType": "admin",

            "_id": "60b2607d6a286901dffe61fa"



            "name": "public",

            "description": "دسترسی های این نقش برای همه کاربران ثبت نام شده و احراز هویت شده مجاز است.",

            "code": "fh1xqE",

            "permissions": [






            "protected": true,

            "userType": "client",

            "_id": "60b2607f6a286901dffe61fb"



    "totalDocs": 2,

    "limit": 100,

    "totalPages": 1,

    "page": 1,

    "pagingCounter": 1,

    "hasPrevPage": false,

    "hasNextPage": false,

    "prevPage": null,

    "nextPage": null



i wanna test that this code “T11A21” dont be in the response

i dont know what is the code
my test is check this id shouldent be in this response

Hi ,

So you could have a simple for loop to check the data coming back is not equal to the target code. This works if the response always stores the code property in the array.

const responseBody = pm.response.json();
const resCode =;
const targetCode = 'T11A21';

pm.test('target code is not equal to response code', () => {
    for(let i = 0; i < resCode.length; i++) {