First add dependency to your project for easy json comparison, e.g
testImplementation("org.skyscreamer:jsonassert:1.5.0") in gradle based projects
Next, create a Test file and paste below code into the file
public class JsonComparisonTest {
ObjectMapper objectMapper = new ObjectMapper();
@Test