Gson Java reserved keyword

You could use a different name for your field, using gson’s Field Naming Support.

public class Post {
    @SerializedName("public")
    private boolean isPublic;
    ...
}

Leave a Comment