我正在使用傑克遜2.3和我有一些問題反序列化。反序列化傑克遜2.3返回null對象
我有這些類和接口:
FollowValue:
public class FollowValue implements Value{
@JsonProperty("id");
public long id;
@JsonProperty("time_creation")
@JsonDeserialize(using = DateDeserializer.class)
public Date timeCreation;
@JsonProperty("follower")
private User follower;
@JsonProperty("user")
private User user;
@Override
public long getId() {
return id;
}
@Override
public Date getTimeCreation() {
return timeCreation;
}
}
值:
public interface Value {
public long getId();
public Date getTimeCreation();
}
當我讀到這樣的FollowValue:
FollowValue value = mapper.readValue(valueNode.traverse(), FollowValue.class);
也不例外是s howed和follower和用戶爲空。我已經搜索了一個解決方案,但我只找到以前版本的Jackson的文檔。我怎樣才能反序列化呢?
謝謝!
這是我試圖解析JSON:
"type": "Follow",
"value": {
"id": 205,
"time_creation": "2014-03-04T14:54:53+0100",
"follower": {
"id": 62,
"username": "[email protected]",
"fullname": "Meri Riera",
},
"user": {
"id": 24,
"username": "[email protected]",
"fullname": "Héctor",
}
}
** valueNode **結構如何看起來像? – tmarwen
我已更新我的問題 – user3382644