I'm writing a step definition using cucumber to verify that my two responses which are in JSON format are same or different

I have two response retrieving from different places of same user, I need to apply assert function to verify that those two responses are same or different. If different i need to call my update function to update the response?

Can someone help?