Unrecognized field not marked as ignorable

走着路睡觉
  • java
小于 1 分钟

1.在类上增加JsonIgnoreProperties注解

import com.fasterxml.jackson.annotation.JsonIgnoreProperties

@JsonIgnoreProperties
class { ... }

#2. 设置属性

ObjectMapper objectMapper = getObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
上次编辑于:
贡献者: zhaojingbo
Loading...