I'm hitting two different tables that each return an object of trips, and my goal is to see which trips overlap in each response object. Each object has a key/value of Origin (id of location) and Destination (id of location). How do I iterate through both objects to create a new object that only returns the trips with matching origin and destination key-value pairs?
Example: response_one =
[{'DestinationID': 'a','OriginID': 'b'},
{'DestinationID': 'c','OriginID': 'd'},
{'DestinationID': 'c','OriginID': 'a'}]
response_two =
[{'DestinationID': 'd','OriginID': 'b'},
{'DestinationID': 'e','OriginID': 'd'},
{'DestinationID': 'c','OriginID': 'a'}]
In this case, DestinationID: "c"
and OriginID: "a"
are the only ones that are present in both. So How would I go about getting finding which Origin AND Destination ID match in both objects?