how to handle POJO class value that can either be null or integer

  android, java, kotlin, pojo

Here is the value as represented in the POJO class when it is null

  @SerializedName("parent_id")
    @Expose
    private Object parentId;

and when it is not

    @SerializedName("parent_id")
    @Expose
    private Integar parentId;

How can it be represented to avoid errors due to type mismatch

Source: Android Questions

LEAVE A COMMENT