Thanks for pointing that out, I just updated the wiki page for it. -- Willem Jiang
Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On June 13, 2014 at 7:20:20 AM, md97212 (m...@qwizics.com) wrote: > This example has a typo, should be the HEIGHT field that is missing > > > -------- > > As of Camel 2.10 > When marshalling a POJO to JSON you might want to exclude certain fields > from the JSON output. With Jackson you can use JSON views to accomplish > this. First create one or more marker classes. > public class Views { > > static class Weight { } > static class Age { } > } > Use the marker classes with the @JsonView annotation to include/exclude > certain fields. The annotation also works on getters. > @JsonView(Views.Age.class) > private int age = 30; > > private int height = 190; > > @JsonView(Views.Weight.class) > private int weight = 70; > Finally use the Camel JacksonDataFormat to marshall the above POJO to JSON. > JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, > Views.Age.class); > from("direct:inPojoAgeView").marshal(ageViewFormat); > Note that the weight field is missing in the resulting JSON: > {"age":30, "height":190} > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Documentation-bug-at-http-camel-apache-org-json-html-tp5752215.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >