Как добавить в сериализацию json новое поле
у меня ситуация следующая. Имеется json в базе данных, когда я его получаю, то делаю сериализацию, тоесть перевожу его в объект. И мне нужно добавить новое поле. А при добавлении у меня его нету json
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonObject {
public JsonObject(){
this.duels = new Duels();
this.general = new GeneralData();
}
public Duels duels;
public GeneralData general;
}
@JsonIgnoreProperties(ignoreUnknown = true)
class GeneralData{
public int money = 0;
public boolean accountProtect = false;
}
@JsonIgnoreProperties(ignoreUnknown = true)
class Duels{
public int rank = 0;
public Duels(){
this.cosmetic = new CosmeticData();
this.statistic = new StatisticData();
}
public CosmeticData cosmetic;
public StatisticData statistic;
}
@JsonIgnoreProperties(ignoreUnknown = true)
class CosmeticData{
public String prefix;
public String fakeNickname;
public int fakeRank;
public List<Integer> availableSides = new ArrayList<Integer>();
public int selectedCape = 0;
public int selectedPet = 0;
public int selectedKillEffect = 0;
public int selectedKillMessages = 0;
}
@JsonIgnoreProperties(ignoreUnknown = true)
class StatisticData{
public int kills = 0;
public int deaths = 0;
public int wins = 0;
public int loses = 0;
}
я добавил следующее
public HashMap<Integer, Boolean> settings = new HashMap<Integer, Boolean>(){{
put(StaffIds.CPS_SETTINGS.ordinal(), false);
put(StaffIds.DISTANCE_SETTINGS.ordinal(), false);
}};
В итоге json не изменился
{
"duels": {
"rank": 0,
"cosmetic": {
"prefix": "",
"fakeNickname": "",
"fakeRank": -1,
"availableSides": [],
"selectedCape": 0,
"selectedPet": 0,
"selectedKillEffect": 12,
"selectedKillMessages": 16
},
"statistic": {
"kills": 0,
"deaths": 9,
"wins": 0,
"loses": 0
}
},
"general": {
"money": 0,
"accountProtect": false
}
}