使用 RestAssured 我正在尝试比较两个 JSON 对象。
示例:第一个 JSON 来自 excel 我将其作为字符串读取并存储
String a = "Some JSON from Excel and I store it as a String";
第二个 JSON 是返回响应对象的响应,该对象实际上是 JSON
Response expectedResponse = RestAssured.given().contentType("application/json").header(auth).get(endpoint).then().contentType("application/json").extract().response();
我想将这两个作为 JSON 对象进行比较,因为当我将响应转换为 String 并尝试进行比较时,如果 JSON 模式的顺序发生变化,我的断言就会失败。
我尝试了将字符串转换为 JSON 的方法,但找不到任何方法。有人可以帮我解决这个问题