且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java - 将嵌套的json反序列化为对象

更新时间:2023-01-16 23:04:31

假设您错过了 RandomBixi Class 中的两个属性。

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....
}

如果您不希望在属性上使用 @JsonIgnore 映射所有属性。

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