# How to compare data from an object

**URL:** <https://community.postman.com/t/how-to-compare-data-from-an-object/16893>\
**Category:** Help Hub\
**Created:** [October 19, 2020, 12:35pm UTC](https://community.postman.com/t/how-to-compare-data-from-an-object/16893 "2020-10-19T12:35:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coxjeffrey](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Coxjeffrey](https://community.postman.com/u/Coxjeffrey)\
**Post date:** [October 19, 2020, 12:35pm UTC](https://community.postman.com/t/how-to-compare-data-from-an-object/16893/1 "2020-10-19T12:35:05Z")

</div>

Hi there,

I would like to validate some objects & arrays from the response body.  
The responseBody is something like this:  
HolidayRightsResults": [  
{  
“NissNumber”: ,  
“HolidayRights”: ,  
“CalculationMessages”: [  
{  
“Timestamp”: ,  
“NewEmployerNumber”:,  
“EmployeeNumber”: ,  
“Type”: ,  
“Message”: ,  
“Details”: ,  
“Code”: ,  
“Info”:  
}  
]  
},  
{  
“NissNumber”: ,  
“HolidayRights”: ,  
“CalculationMessages”: [  
{  
“Timestamp”: ,  
“NewEmployerNumber”:,  
“EmployeeNumber”: ,  
“Type”: ,  
“Message”: ,  
“Details”: ,  
“Code”: ,  
“Info”:  
}  
]  
},  
{  
“NissNumber”: ,  
“HolidayRights”: ,  
“CalculationMessages”: [  
{  
“Timestamp”: ,  
“NewEmployerNumber”:,  
“EmployeeNumber”: ,  
“Type”: ,  
“Message”: ,  
“Details”: ,  
“Code”: ,  
“Info”:  
}  
]  
},

Now I want to validate if HolidayrightsResults.Nissnumber and HolidayRightsResults.CalculationMessages.Type from every array with an object in a variable with the same structure like the responsebody. But I dont want to check every returned value in the object.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [October 20, 2020, 6:56pm UTC](https://community.postman.com/t/how-to-compare-data-from-an-object/16893/2 "2020-10-20T18:56:21Z")

</div>

It seems that what you are looking for is a schema validation.

This tutorial I have created a while back may help you get started.

[![](https://img.youtube.com/vi/haDQBmQii2g/maxresdefault.jpg "JSON Schema validation in Postman") ](https://www.youtube.com/watch?v=haDQBmQii2g)

---

<div class="post-metadata">

**Author:** ![Coxjeffrey](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@Coxjeffrey](https://community.postman.com/u/Coxjeffrey)\
**Post date:** [October 21, 2020, 7:16am UTC](https://community.postman.com/t/how-to-compare-data-from-an-object/16893/3 "2020-10-21T07:16:55Z")

</div>

I want to check the actuele values for Nissnumber, In this case I left the values out for privacy reasons.  
Not the schema.

---

<div class="post-metadata">

**Author:** ![meenakshi.dhanani](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/meenakshi.dhanani/32/5980_2.png) [@meenakshi.dhanani](https://community.postman.com/u/meenakshi.dhanani)\
**Post date:** [October 21, 2020, 7:56am UTC](https://community.postman.com/t/how-to-compare-data-from-an-object/16893/4 "2020-10-21T07:56:18Z")

</div>

Hey Coxjeffrey,  
I found a lot of ways to assert values from the response as part of this community showcase. You’d like to have a look at the 2 and 7 cases in this list - [Community Showcase - Assertions on API Test scripts](https://community.postman.com/t/assertions-for-api-test-scripts/8717).

You could loop through the array and assert only the values that you’d like say Nissnumber.

Hope that helps!
