In Spring XML you can declare a bean with the json data format and
configure it the usual spring way

<bean id="json" class="org.apache.camel.component.jackson.JacksonDataFormat">
 ...
</bean>

And then in the Camel route you can refer to this data format using
its id="json"

Something a like:
<marshal ref="json">

But we should consider adding a jsonView attribute to the <json> so
you can configure it there also.
Ideally we should maybe have had a <jackson> instead and not a <json>
used by both xstream and jackson.


On Sat, May 18, 2013 at 7:17 PM, mbhaya <[email protected]> wrote:
> Hi,
>
> I am working on JSON marshalling/unmarshalling and need to exclude certain
> POJO fields from marshalling.
> I have referred to the following link:
>            http://camel.apache.org/json.html
>
> It says that JSON View needs to be used.
>
> And after that we need to specify the following in the java file.
>
> JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class,
> Views.Age.class);
> from("direct:inPojoAgeView").marshal(ageViewFormat);
>
> I want to specify the above configuration in spring xml file. I know that we
> can specify the dataformats in the following way:
>  <json id="jack" library="Jackson"
> unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/>
> But  I want to configure the JSON view(JacksonDataFormat ageViewFormat = new
> JacksonDataFormat(TestPojoView.class, Views.Age.class)) in the spring xml
> itself.
>
> Please let me know how to do that.
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-JacksonDataFormat-configuration-in-Spring-XML-tp5732801.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to