Ignore specific nodes/attributes while comparing two JSONs
You can use Customization for this. For example, if you need to ignore a top-level attribute named “timestamp” use: JSONAssert.assertEquals(expectedResponseBody, responseBody, new CustomComparator(JSONCompareMode.LENIENT, new Customization(“timestamp”, (o1, o2) -> true))); It’s also possible to use path expressions like “entry.id”. In your Customization you can use whatever method you like to compare the two values. The example … Read more