请放心在 java 中提取 json 响应中的值

Rest assured extracting values in json response in java

如何使用 java 在以下 JSON 响应中提取名称?

{
  "type": "students",
  "values": [
    {
      "id": "123",
      "name": "Raj"
          
    },
    {
      "id": "456",
      "name": "Rahul"
         
    }
  ]
}

获取全部names:

Response res = ...;
List<String> names = res.jsonPath().getList("values.name");
System.out.println(names); //[Raj, Rahul]