[英]How to serialize/deserialize third party Java objects with Jackson
As an example, I'd like to serialize/deserialize one object of Slick2d's Animation class using Jackson. 作为一个例子,我想使用Jackson序列化/反序列化Slick2d的Animation类的一个对象。 What is the simplest way to do this?
最简单的方法是什么?
You can annotate a mix-in interface if you want to control the generated json on third party classes. 如果要控制第三方类上生成的json,可以注释混合接口。
read more here: http://wiki.fasterxml.com/JacksonMixInAnnotations 在这里阅读更多内容: http : //wiki.fasterxml.com/JacksonMixInAnnotations
Update : The current documentation (v2+) is here: https://github.com/FasterXML/jackson-docs/wiki/JacksonMixInAnnotations 更新 :当前文档(v2 +)位于: https : //github.com/FasterXML/jackson-docs/wiki/JacksonMixInAnnotations
就像任何对象一样 - 将它传递给objectMapper.readValue(..)
/ objectMapper.writeValue(..)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.