问题描述
在某些情况下,我需要在使用Jackson2编组/解组JSON的同时更改序列化/反序列化的值。
I have a need in certain cases to alter the serialized/deserialized value while marshalling/unmarshalling JSON using Jackson2.
是否存在类似于javax.xml的机制.bind.Unmarhsaller.Listener / javax.xml.bind.Marshaller.Listener?
Does there exist a mechanism similar to javax.xml.bind.Unmarhsaller.Listener/javax.xml.bind.Marshaller.Listener?
推荐答案
没有。有人请求后处理钩子,尤其是。用于反序列化,但尚未实现。
No. There have been requests for post-processing hooks, esp. for deserialization, but no implementation yet.
Jackson 2.2将附带 Converter
注释( @JsonSerialize(converter = MyConverter.class)
, @JsonDeserialize(converter = ...)
)可能用于类似目的。这类似于JAXB XmlJavaAdapter
。
Jackson 2.2 will come with Converter
annotation (@JsonSerialize(converter=MyConverter.class)
, @JsonDeserialize(converter=...)
) which could perhaps be used for similar purpose. This is similar to JAXB XmlJavaAdapter
.
这篇关于Jackson2是否提供类似于JAX-B的Marshaller / Unmarshaller Listener的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!