使用LongSquare解析Json时出现错误

时间:2019-10-03 17:54:38

标签: java logan-square

我该怎么办?

import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;

/**
 * Created by AhmtBrK on 07/11/2017.
 */
@JsonObject
public class FaqItem {
    @JsonField(name = "id")
    private int id;
    @JsonField(name = "question")
    private String question;
    @JsonField(name = "answer")
    private String answer;

    public FaqItem() {

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }
}
  

错误:如果同时存在getter和setter,则@JsonField批注只能在私有字段上使用。

我该怎么办?

0 个答案:

没有答案