我有这个json taat我试图转换为DataStreams类型的对象:
{
"resultSize": "14",
"requestedSize": "1000",
"pageCursor": "c8bdb3d9-e-ccecb4a7",
"items": [
{ "cstId": "5146"}]}
我有这个课程:
@JsonIgnoreProperties(ignoreUnknown = true)
public class DataStreams {
private String resultSize;
private String requestedSize;
private String pageCursor;
private Item[] items;
public String getResultSize() {
return resultSize;
}
public void setResultSize(String resultSize) {
this.resultSize = resultSize;
}
public String getRequestedSize() {
return requestedSize;
}
public void setRequestedSize(String requestedSize) {
this.requestedSize = requestedSize;
}
public String getPageCursor() {
return pageCursor;
}
public void setPageCursor(String pageCursor) {
this.pageCursor = pageCursor;
}
public Item[] getDataStreams() {
return items;
}
public void setDataStreams(Item[] items) {
this.items = items;
}
}
然后我在我的应用程序类中执行此操作:
DataStreams dataStreams = mapper.readValue(str, DataStreams.class);
但items数组变为null。 如何获取items数组?