# How to compare huge JSON document in which new fields gets added?

**URL:** <https://community.postman.com/t/how-to-compare-huge-json-document-in-which-new-fields-gets-added/6828>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [July 29, 2019, 9:52am UTC](https://community.postman.com/t/how-to-compare-huge-json-document-in-which-new-fields-gets-added/6828 "2019-07-29T09:52:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul.giri](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@rahul.giri](https://community.postman.com/u/rahul.giri)\
**Post date:** [July 29, 2019, 9:52am UTC](https://community.postman.com/t/how-to-compare-huge-json-document-in-which-new-fields-gets-added/6828/1 "2019-07-29T09:52:05Z")

</div>

Hi Team,  
I am using postman for verifying the data fetched from mongoDB( which is a JSON ). The problem is that when new fields in my JSON document gets added, my existing tests keeps failing.  
I am looking for a way to compare two JSON which should ignore new added fields.  
Also, I cannot add multiple asserts because the JSON is too huge and asserting such many JSON fields looks unfeasible.  
Can anyone please help ?

Eg: In below json groupStatus is newly added

```json
{"_embedded":{"nucleusOccupancySummaries":[{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"HAPPY_PATH","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"EXTENSION_BEFORE_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_AFTER_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_BEFORE_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"MU100","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"MU200","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_ON_CONFIRMEDMSG","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"UNITREDUCE_BY_ONE","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"UNITREDUCE_BY_TWO","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"UNITREDUCE_BY_THREE","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"REDUCE_CANCELLATION_BEFORE_FIRST_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"REDUCEBY2_CANCELLATION_BEFORE_FIRST_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"UNITUPDATE_POSTSPLIT","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_2SPLIT_SINGLERATE","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_2SPLIT_MULTIRATE","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_1SPLIT_MULTIRATE","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"REDUCEBY1_CANCELLATION_OF_CONFIRMED_RES","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"REDUCEBY2_CANCELLATION_OF_CONFIRMED_RES","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"INCREASE_2SPLIT","reservationStatus":"RESERVED","occupancyDate":"2014-06-16 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK1","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":0,"transientSold":null,"groupSold":null,"roomRevenue":0,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":0,"arrivals":0,"departures":1,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":0,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"HAPPY_PATH","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":98,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":98,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":98,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"EXTENSION_BEFORE_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"MTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA2","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":77,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":77,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":77,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"MTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_AFTER_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":98,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":98,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":98,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"CANCELLATION_BEFORE_CONFIRMATION","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":98,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":98,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":98,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"MU100","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":98,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":98,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":98,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},{"clientCode":"SandBox","propertyCode":"NGI02","reservationId":"MU200","reservationStatus":"RESERVED","occupancyDate":"2014-06-15 00:00:00.000","marketSegmentCode":"KTRAN","roomTypeCode":"SK","roomNumber":null,"rateCode":"AAA3","block":null,"pickup":null,"groupOccupancy":false,"roomsSold":1,"transientSold":null,"groupSold":null,"roomRevenue":98,"foodRevenue":0,"beverageRevenue":0,"otherRevenue":0,"totalRevenue":98,"arrivals":0,"departures":0,"cancellations":0,"noShows":0,"accomCapacity":null,"roomsNotAvailableMaintenance":null,"roomsNotAvailableOther":null,"groupId":null,"roomRate":98,"correlationId":null,"amsInPlay":false,"analyticalMarketSegmentCode":"KTRAN","groupStatus":null},]}}

```

---

<div class="post-metadata">

**Author:** ![aamir.ahmed](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@aamir.ahmed](https://community.postman.com/u/aamir.ahmed)\
**Post date:** [July 30, 2019, 5:54am UTC](https://community.postman.com/t/how-to-compare-huge-json-document-in-which-new-fields-gets-added/6828/2 "2019-07-30T05:54:59Z")

</div>

Hi @rahul.giri,

This sounds like a use case for using JSON schemas to validate your JSON response data, you can use AJV to execute the same on Postman, Github link given here for your reference: [https://github.com/epoberezkin/ajv](https://github.com/epoberezkin/ajv) . AJV allows you to use JSON schemas to specify the JSON response data you wish to validate while ignoring other data if you wish to do so.

Regards,  
Aamir
