我从Web服务收到JSON响应。我正在尝试将响应中的JSON数组转换为AllActivities类型的对象。
我正在从WebClient.get方法检索结果,但未将其编组到项目列表中。我感兴趣的编组部分是名为value的数组
这是返回的JSON的示例
{
"@odata.context":"https://lms-odata.com/...",
"value":
[{"ACCOUNT_ID":4401,"ACCOUNT_NAME":"Sandbox - Data","ACTIVITY_IS_PREDEFINED":"False","ACTIVITY_NAME":"Login","APPLICATION_NAME":"BranchPortal","APPLICATION_TYPE":"WindowsApp","TIME_LAST_REPORTING":"2019-04-30T00:00:00-04:00","USERS_COUNT_LAST_7_DAYS":27.0,"VOLUME_LAST_7_DAYS":4291.0},
..],
"odata.nextlink":""
}
这是我使用的代码,AllActivities类是一个简单的POJO:
ResponseSpec thereturnbody = webClient.get().
uri(getPropertyName().concat(urlAppended)).
retrieve();
List<T> returnvalue = thereturnbody.bodyToFlux(AllActivities.class).collectList().block();
return returnvalue;
实际结果以1项列表的形式返回,且所有值均为空