简体   繁体   English

ObjectMapper.readValue可以返回null值吗?

[英]ObjectMapper.readValue can return null value?

ObjectMapper.readValue in Jackson library does return null value. Jackson库中的ObjectMapper.readValue确实返回null值。 In what case does it return null object? 在什么情况下它返回null对象? 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 您可以浏览ObjectMapper类来深入了解更多细节

readValue() returns null for JSON input consisting of JSON value null . readValue()为JSON输入返回null ,包含JSON值null It does not return null for any other case: missing input (for example) would be rewarded by an exception; 对于任何其他情况,它不返回null :缺少输入(例如)将由异常奖励; and no deserializer produces null by default. 并且默认情况下没有反序列化器生成null

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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