Deserializing an enum with Jackson

后端 未结 6 964
孤城傲影
孤城傲影 2020-12-02 16:35

I\'m trying and failing to deserialize an enum with Jackson 2.5.4, and I don\'t quite see my case out there. My input strings are camel case, and I want to simply map to sta

6条回答
  •  猫巷女王i
    2020-12-02 16:57

    @JsonCreator
    public static Status forValue(String name)
    {
        return EnumUtil.getEnumByNameIgnoreCase(Status.class, name);
    }
    

    Adding this static method would resolve your problem of deserializing

提交回复
热议问题