これが私のJSONです:
{
"i": 53691,
"s": "Something" }
これが私のモデルです:
public class Test() {
private int i;
private String s;
public setInt(int i){ this.i = i; }
public setString(String s){ this.s = s; }
// getters here
}
サーバーの応答のクラスは次のとおりです。
public class ServerResponse(){
private Test;
public void setTest(Test test){ this.test = test;}
public Test getTest(){ return Test; } }
私がする時:
ObjectMapper mapper = new ObjectMapper();
mapper.readValue(json, serverResponse);
次のような例外が発生します。
JsonProcessingException: 認識されないフィールド "i" (クラス MyClass)、無視可能としてマークされていません
ご意見をお聞かせください。