Jackson处理器用于java bean到json \ xml序列化 [英] Jackson processor for java bean to json\xml serialization
问题描述
您好我有一个java bean,我需要将它序列化为json。为此,我使用的是非常强大的jackson处理器。但我还需要将java bean转换为XML。
这可以用杰克逊处理器实现吗?如果是,那么请提供我可以获得示例的链接。
谢谢!!!!
Hi I am having a java bean and i need to serialize it to json. For this purpose i am using the jackson processor which is very powerful. But I also need to convert the java bean to XML. Can this be achieved using the jackson processor ?? If yes then please provide with the links where I can get the examples. Thanks!!!!
推荐答案
是的,这是可能的。您需要使用JAXB注释来注释Java bean,这将为您提供XML编组和解组支持。然后,使用 Jackson的支持进行JAXB注释,您可以在Java之间来回切换和JSON。
Yes it is possible. You would need to annotate your Java bean using the JAXB annotations which will give you the XML marshalling and unmarshalling support. Then, using Jackson's support for JAXB annotations you can go back and forth between Java and JSON.
这篇关于Jackson处理器用于java bean到json \ xml序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!