Java Jayway Rest-Assured Json路径到字符串转换

Java Jayway Rest-Assured Json路径到字符串转换,java,api,automation,rest-assured,Java,Api,Automation,Rest Assured,我从API调用中得到以下响应: [{"id":63,"name":"Apple Inc.","ticker":"AAPL","website":"www.apple.com","street1":null,"street2":null,"country":null,"postal_code":null,"city":null,"state":null,"type_value":"PUBLIC","person":[{"id":6854208},{"id":6854192},{"id":7795}

我从API调用中得到以下响应:

[{"id":63,"name":"Apple Inc.","ticker":"AAPL","website":"www.apple.com","street1":null,"street2":null,"country":null,"postal_code":null,"city":null,"state":null,"type_value":"PUBLIC","person":[{"id":6854208},{"id":6854192},{"id":7795},{"id":6837866},{"id":6854188},{"id":6840774},{"id":6838278},{"id":7637},{"id":6839671},{"id":6837862},{"id":6840759},{"id":6840766},{"id":6838242},{"id":6840830},{"id":6840838},{"id":7875},{"id":3038662},{"id":865765},{"id":6839669},{"id":6837834},{"id":6839685},{"id":6839931},{"id":6840777},{"id":6838232},{"id":6838260},{"id":1859904},{"id":6854204},{"id":6838238},{"id":6839751}],"type":3001,"revenue":null,"industry":[{"industry":"Computer Hardware","industry_id":5009},{"industry":"Electronics","industry_id":5016},{"industry":"Technology - All","industry_id":5044}],"description":null}]
如何从响应中获取name的值

这就是我现在拥有的:

    System.err.println("fullBspApiUrl"+fullBspApiUrl);
    Response resp = get(fullBspApiUrl);
    System.err.println("This is response"+resp);
    String bJson = resp.asString();
    System.err.println("This is response after string conversion"+bJson);
    JsonPath jsonpath = new JsonPath(bJson);
    System.err.println("Instantiate JsonPath "+jsonpath);
    //String bspOrgName = jsonpath.getString("organizationName[0]");
    String bspOrgName = jsonpath.getString("organizationName[0]");
    System.err.println("This is response after JsonPath string conversion "+bspOrgName);

    assertEquals(resp.getStatusCode(),200);
    assertEquals(bspOrgName,"Apple Inc");

它返回
Null
而不是
Apple

name[0]
工作正常。之前的响应将其命名为
OrganizationName

name[0]
工作正常。上一个响应的名称为
OrganizationName

您可以尝试resp[0]吗?名称?名称[0]工作正常:)请将其添加为回答您可以尝试resp[0]吗?名称?名称[0]工作正常:)请将其添加为回答请为您的回答添加一些解释!请给你的答案加上一些解释!
get(fullBspApiUrl).then().statusCode(200).
and().assertThat().body(name[0], equalTo("Apple Inc"))