I have some probleme to deserialize some nested Json.
The json : Json Link Here To deserialize :
ObjectMapper objectMapper = new ObjectMapper();
ListRandomBixi bixi = objectMapper.readValue(url, ListRandomBixi.class);
And the two classes :
class ListRandomBixi{
@JsonProperty("stations")
ArrayList<RandomBixi> arrayBixi;
@JsonProperty("schemeSuspended")
boolean schemeSuspended;
@JsonProperty("timestamp")
long timeStanp;
@JsonCreator
public ListRandomBixi(@JsonProperty("stations") ArrayList<RandomBixi> arrayBixi, @JsonProperty("schemeSuspended") boolean schemeSuspended, @JsonProperty("timestamp") long timeStanp) {
this.arrayBixi = arrayBixi;
this.schemeSuspended = schemeSuspended;
this.timeStanp = timeStanp;
}
getters & setters....
}
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("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....
}
I'm getting this error : com.fasterxml.jackson.databind.JsonMappingException: Unrecognized Type: [null]
Any suggestions?
Thanks
The value of blabla1
and blabla2
are also text. But you are declare class field is boolean
and long
. This cause the error. Let's change the type of blabla1
and blabla2
to String
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.