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

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

{"_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},]}}

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 . 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

1 Like