简体   繁体   中英

ObjectMapper.readValue can return null value?

ObjectMapper.readValue in Jackson library does return null value. In what case does it return null object? It found that from codebase.

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>1.9.9</version>
</dependency>

You can browse through ObjectMapper class to dig in more details

readValue() returns null for JSON input consisting of JSON value null . It does not return null for any other case: missing input (for example) would be rewarded by an exception; and no deserializer produces null by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM