Java - Deserialize nested json to object

我只是一个虾纸丫 提交于 2019-12-12 07:03:02

问题


I have problems to deserialize some nested Json.

The json : JSON LINK HERE

To deserialize :

And the two classes :

I'm getting this Exception :

com.fasterxml.jackson.databind.JsonMappingException: Unrecognized Type: [null]

Any suggestions?


回答1:


suppose you have missed two properties in your RandomBixi Class.

class RandomBixi {
@JsonProperty("id")
int id;
@JsonProperty("s")
String nom;
@JsonProperty("n")
int idTerminal;
@JsonProperty("st")
int etatStation;
@JsonProperty("b")
boolean bloque;
@JsonProperty("su")
boolean suspendue;
@JsonProperty("m")
boolean hs;
@JsonProperty("lu")
int lu;
@JsonProperty("lc")
int lc;
@JsonProperty("bk")
boolean bk;
@JsonProperty("bl")
boolean bl;
@JsonProperty("la")
String latitude;
@JsonProperty("lo")
String longitude;
@JsonProperty("da")
int borneDispo;
@JsonProperty("dx")
int dx;
@JsonProperty("ba")
int bixiDispo;
@JsonProperty("bx")
int bx;

  getters ans setters....
}

If you don't want all the properties to be mapped use @JsonIgnore on the property.



来源:https://stackoverflow.com/questions/45260691/java-deserialize-nested-json-to-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!