我在Robospice和Google HTTP Java 客户端中使用了这个 Request 类:
public class MyRequest {
@Key
private List<String> Items;
//.....
}
我使用的是:
MyRequest myRequest = new MyRequest();
myRequest.setItems(data);
this.postMyRequest = new PostMyRequest(myRequest);
getSpiceManager().execute(postMyRequest, new PostMyRequestListener());
和
JsonHttpContent jsonHttpContent = new JsonHttpContent(new JacksonFactory(), this.myRequest);
HttpRequest httpRequest = getHttpRequestFactory()
.buildPostRequest(new GenericUrl(this.baseUrl), jsonHttpContent);
httpRequest.setParser(new JacksonFactory().createJsonObjectParser());
Response response = httpRequest.execute().parseAs(getResultType());
如何将根数组名称(从“项目”)更改为其他名称?我已经尝试过@JsonProperty("Foo")
,但这并没有做任何事情。