THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
When marshalling a POJO to JSON XML you might want to exclude certain fields from the JSON XML output. With Jackson you can use JSON views to accomplish this. First create one or more marker classes.
Wiki Markup |
---|
{snippet:id=marker|lang=java|url=camel/trunk/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/Views.java} |
@JsonView
annotation to include/exclude certain fields. The annotation also works on getters.Wiki Markup |
---|
{snippet:id=jsonview|lang=java|url=camel/trunk/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/TestPojoView.java} |
JacksonXMLDataFormat
to marshall the above POJO to XML.Wiki Markup |
---|
{snippet:id=format|lang=java|url=camel/trunk/components/camel-jacksonxml/src/test/java/org/apache/camel/component/jacksonxml/JacksonMarshalViewTest.java} |
Code Block |
---|
{"<pojo age=":30," "weight=":70}"/> |
Include/Exclude fields using the jsonView
attribute with JacksonXML
DataFormat
...