2

次のクラスを定義しています

@JsonTypeName("PhotoSetUpdater")
public class PhotoSetUpdater {
@JsonProperty("Title")
private String title;
@JsonProperty("Caption")
private String caption;
@JsonProperty("Keywords")
private String[] keywords;
@JsonProperty("Categories")
private int[] categories;
@JsonProperty("CustomReference")
    private String customReference;      // new in version 1.1


public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

public String getCaption() {
    return caption;
}

public void setCaption(String caption) {
    this.caption = caption;
}


public String getCustomReference() {
    return customReference;
}


public void setCustomReference(String customReference) {
    this.customReference = customReference;
}


public void setKeywords(String[] keywords) {
    this.keywords = keywords;
}

public String[] getKeywords() {
    return keywords;
}


public void setCategories(int[] categories) {
    this.categories = categories;
}


public int[] getCategories() {
    return categories;
}

}

問題は、このクラスをJackson JSONシリアライザーでシリアル化した後、フィールドが結果のペイロードに2回挿入されることです。1つは小文字で始まり、もう1つは大文字で始まります。

... {"Caption": "aa"、 "caption": "aa"、...}

タイプ定義の何が問題になっている可能性がありますか?

よろしく

4

1 に答える 1

6

@JsonAutoDetect(getterVisibility=Visibility.NONE)クラスで使ってみてください。

于 2011-09-26T16:02:37.897 に答える