【问题标题】:fasterxml jackson: there is no necessary methods to use @JsonView functionalityfastxml jackson:没有必要的方法来使用@JsonView 功能
【发布时间】:2013-07-29 12:57:08
【问题描述】:

当我将 java-object 转换为 json-string 时,我尝试组织动态 @JsonIgnore 属性。在example 它以另一种方式工作 为(codehaus 杰克逊) ObjectMapper oMapper = new ObjectMapper(); oMapper.setSerializationConfig(...

或在example 中获取更快的xml objectMapper.getSerializationConfig().setSerializationView(

问题: my jackson 中没有粗体方法:

pom.xml

<jackson.version>2.1.1</jackson.version>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>${jackson.version}</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>${jackson.version}</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>${jackson.version}</version>
</dependency>

【问题讨论】:

    标签: json jackson fasterxml


    【解决方案1】:

    查看ObjectWriterObjectReader,它们确实包含设置要使用的活动视图的功能。这与 Jackson 1.x 不同,后者通过SerializationConfigDeserializationConfig 暴露它们。 您可以从ObjectMapper (mapper.readerXxx() 和 mapper.writerXxx()) 构造这些对象;它们是可重用的,并且比ObjectMapper 提供更多的线程安全配置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 2018-04-02
      • 2013-05-28
      • 2018-12-23
      • 2011-11-30
      • 2015-10-07
      相关资源
      最近更新 更多