问题
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