# Jackson 的 DeserializationFeature.FAIL\_ON\_UNKNOWN\_PROPERTIES

**URL:** <https://www.isharkfly.com/t/jackson-deserializationfeature-fail-on-unknown-properties/14311>\
**Category:** 程序语言\
**Tags:** java\
**Created:** [February 3, 2023, 9:22pm UTC](https://www.isharkfly.com/t/jackson-deserializationfeature-fail-on-unknown-properties/14311 "2023-02-03T21:22:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [February 3, 2023, 9:22pm UTC](https://www.isharkfly.com/t/jackson-deserializationfeature-fail-on-unknown-properties/14311/1 "2023-02-03T21:22:52Z")

</div>

API 文档中的说法就是：

Feature that determines whether encountering of unknown properties (ones that do not map to a property, and there is no “any setter” or handler that can handle it) should result in a failure

![2023-02-03_16-20-40](https://www.isharkfly.com/images/transparent.png)

反序列化时遇到未知属性（那些没有对应的属性来映射的属性,并且没有任何setter或handler来处理这样的属性）是否抛出处理失败的异常。

## 说明

简单来说，就是在进行序列化或者反序列化的时候。

JSON 字符串中有一个字段，但是我们的对象没有这个字段，那么处理器应该做什么的配置。

默认情况下是抛出异常，如果不想抛出异常只想处理继续进行的话，这个参数要设置为 False。
