# How to compare all the fields and their values in the response body?

**URL:** <https://community.postman.com/t/how-to-compare-all-the-fields-and-their-values-in-the-response-body/30757>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [December 16, 2021, 3:48am UTC](https://community.postman.com/t/how-to-compare-all-the-fields-and-their-values-in-the-response-body/30757 "2021-12-16T03:48:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![swaroopaw](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@swaroopaw](https://community.postman.com/u/swaroopaw)\
**Post date:** [December 16, 2021, 3:48am UTC](https://community.postman.com/t/how-to-compare-all-the-fields-and-their-values-in-the-response-body/30757/1 "2021-12-16T03:48:23Z")

</div>

_My question_: Hi all,  
I want to verify around 500 fields and their values (assert expected values to actual values) in response.

_I’ve already tried_:  
I have tried ajv tests and I do get failure mgs however the test result does not tell me which field(s) did not match the expected value.  
The test result tells me on a high level that the assertion failed and gives me the whole response (which is not helpful as there are 500 fields).

Is there a way/test script that will pin-point/tell me where exactly the test failed eg. the field name which had incorrect value

_Details (like screenshots)_:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/4/c4b445c7d776b75826f5d5f76dfd35fec60c4529.jpeg)

Here, if the AppNumber is incorrect (expected=12345 \<\> actual=1234), I get Failed mgs with the entire response body instead of the Field name.

ResponceBody like:  
{  
“Application”: {  
“AppNumber”: “12345”,  
“App”: true,  
“Apptravel”: true,  
“ABC”: [  
{  
“ABCType”: “string”,  
“Names”: “string”,  
“familyName”: “string”,  
“otherNames”: “string”,  
“gender”: “string”,  
“dob”: “2021-12-08”  
}  
],

```
"AlertApp": [
  {
    "AlertId": "string",
    "AlertAction": "string",
    "AlertCreatedDate": "string",
    "AlertNumber": "string"
  }
],
"Warnings": [
  {
    
    "warningId": "string",
    "warningType": "string"
  }
]

```

},  
“AnotherArray1”: [  
{  
“SomeFields1”: “Test A User”,  
“SomeFields2”: true,  
“AnotherArrayhere”: [  
“ABC road”  
],

```
  "AnotherArray2": {
    "SomeMoreFields": "2021-12-08"
  },
  "SomeMoreDetails": {
    "Details": {
      "unableCheck": "string"
    },
    "medicalDetails": {
      "isVisitMedicalTreatment": true
    },
    "TravelInfo": {
      "studyStartDate": "2021-12-08"
    }
  },
  "TravelDetails": [
    {
      "startDate": "2021-12-08",
      "endDate": "2021-12-08"
    }
  ],
  "movements": [
    {
      "travelDocNumber": "string",
      "movementType": "Arrived",
      "date": "2021-12-08",
      "embarkationPort": "string",
      "disembarkationPort": "string"
    }
  ],
  "citizenships": [
    {
      "citizenshipCountry": "string",
      "hasTravelDocument": true,
      "nationalIdNumber": "string"
    }
  ],
  "countriesVisited": [
    {
      "country": "string",
      "durationInDays": 0
    }
  ],
  "detentions": [
    {
      "startDate": "2021-12-08",
      "endDate": "2021-12-08",
      "country": "string",
      "reason": "string"
    }
  ],
  "alerts": [
    {
      "alertId": "string",
      "alertCreatedDate": "string",
      "alertNumber": "string"
    }
  ],
  "priorTravels": [
    {
      
      "TravelDuration": 0,
      "priorTravelDetails": {
        "payAndSkillLevel": {
          "annualSalary": 0
        }
      },
      "priorResult": {
        "riskRating": "string",
        "profiledBy": "string",
        "RelatedDate": "string",
        "rulesRelated": [
          "string"
        ]
      },
      "priorApps": [
        {
          "firstName": "string",
          "middleNames": "string",
          "surname": "string"
        }
      ]
    }
  ],
  "TravelHistories": [
    {
      "clientID": 0,
      "dateStarted": "2021-12-08",
      "dateEnded": "2021-12-08"
    }
  ]
}

```

]  
}

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [February 3, 2022, 3:51pm UTC](https://community.postman.com/t/how-to-compare-all-the-fields-and-their-values-in-the-response-body/30757/2 "2022-02-03T15:51:00Z")

</div>

I’m quite new to schema testing myself… but that bit you have scribbled out on the right-hand side is all the fields that dont match the schema right? Isn’t that what you are looking for?

For example;

 ![35h35jh35nj](https://us1.discourse-cdn.com/getpostman/original/3X/6/2/62c84413ab23a81fb8ce421a2508966c591a06a2.png)
