2
我想發送POST請求它的形式是:POST嵌套Json。但漸漸空虛
{
"startTime":"2014-12-02T00:00:00.000Z",
"endTime":"2014-12-03T00:00:00.000Z",
"numRows":200,
"object":{
"key":"I am having trouble parsing you",
"key2":"value2"
}
}
在後端(使用dropwizard),我的資源類定義爲:
class ResourceExample{
public Response process(SearchQuery q){
//doing something
//here q.object = {} instead of {"key": "I am having trouble parsing you", "key2" : "value2"}
}
}
class SearchQuery{
@NotNull
JSONObject object;
@NotNull
String startTime;
@NotNull
String endTime;
@NotNull
int numRows;
//getters and setters present.
}
現在,當我POST請求,「object」的值是{}。 我期待它是{「key」:「我在解析你時遇到問題」,「key2」:「value2」}
請幫我這裏。我確信有一些我錯過了。一些不在我腦海中點擊的東西。我哪裏錯了?
謝謝。當沒有人回答我的問題時,我終於想出了自己。我做了和上面一樣的事情。 我會接受你的解決方案。再次感謝! – Roger 2014-12-17 07:08:26