jjzjj

isCustom

全部标签

java - JSON 中的重复 boolean 字段

我有boolean字段作为privatebooleanisCustom;有getter和setter作为publicbooleanisCustom(){returnisCustom;}publicvoidsetCustom(booleanisCustom){this.isCustom=isCustom;}在这种情况下,我的JSON将是{"custom":false}但我希望JSON为{"isCustom":false}所以我添加了@JsonProperty:@JsonPropertyprivatebooleanisCustom;但现在还有另一个问题,因为我的JSON是{"isCusto