Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AE1F01036D for ; Fri, 13 Jun 2014 02:17:28 +0000 (UTC) Received: (qmail 98863 invoked by uid 500); 13 Jun 2014 02:17:28 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 98806 invoked by uid 500); 13 Jun 2014 02:17:28 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 98795 invoked by uid 99); 13 Jun 2014 02:17:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2014 02:17:28 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.220.42 as permitted sender) Received: from [209.85.220.42] (HELO mail-pa0-f42.google.com) (209.85.220.42) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2014 02:17:26 +0000 Received: by mail-pa0-f42.google.com with SMTP id lj1so1602509pab.1 for ; Thu, 12 Jun 2014 19:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:content-transfer-encoding:content-disposition; bh=+PqkE38+QaIXURykcn1FrUcN7s+U4EMdJyzc9p1dFBY=; b=MUaDJdPueA7O3zED+msoPn+OeC3ImZbnACpg0gZrHlzYLnmE6wEYJUY55yjcFisezP 2BmSnJVy1A1YcH5aEXs7kl1dQpPEsE/T9+VD8ur5adjbG7c5QqhYvTHtbad2NYb4JyDB +v+TLImeU2X/kUsbvql5o2iF7e8cQRA1U/mlBsuBr67I/60uQx/IUMFQYGr2y44tG0wI kpUycsmeg35MxAKvADk/jKeHo9kB1VW8AMqWUp0WXAd9ZZHiwIVCkctiZW1pIJtBejCq lLO3JsfVnTtEZIKcE0awGI8hVpica6jGpNovwcTNouQ3XeF7i9+69eyk4sCxDurR0DmI M2UA== X-Received: by 10.68.193.100 with SMTP id hn4mr16895572pbc.50.1402625821580; Thu, 12 Jun 2014 19:17:01 -0700 (PDT) Received: from localhost ([123.116.39.132]) by mx.google.com with ESMTPSA id nh8sm540534pbc.25.2014.06.12.19.16.55 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 19:16:56 -0700 (PDT) Date: Fri, 13 Jun 2014 10:16:42 +0800 From: Willem Jiang To: users@camel.apache.org Message-ID: In-Reply-To: <1402593808619-5752215.post@n5.nabble.com> References: <1402593808619-5752215.post@n5.nabble.com> Subject: Re: Documentation bug at http://camel.apache.org/json.html X-Mailer: Airmail (237) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Thanks for pointing that out, I just updated the wiki page for it. -- =20 Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang =20 Weibo: =E5=A7=9C=E5=AE=81willem On June 13, 2014 at 7:20:20 AM, md97212 (md=40qwizics.com) wrote: > This example has a typo, should be the HEIGHT field that is missing > =20 > =20 > -------- > =20 > As of Camel 2.10 > When marshalling a POJO to JSON you might want to exclude certain field= s > from the JSON output. With Jackson you can use JSON views to accomplish= > this. =46irst create one or more marker classes. > public class Views =7B > =20 > static class Weight =7B =7D > static class Age =7B =7D > =7D > Use the marker classes with the =40JsonView annotation to include/exclu= de > certain fields. The annotation also works on getters. > =40JsonView(Views.Age.class) > private int age =3D 30; > =20 > private int height =3D 190; > =20 > =40JsonView(Views.Weight.class) > private int weight =3D 70; > =46inally use the Camel JacksonData=46ormat to marshall the above POJO = to JSON. > JacksonData=46ormat ageView=46ormat =3D new JacksonData=46ormat(TestPoj= oView.class, =20 > Views.Age.class); > from(=22direct:inPojoAgeView=22).marshal(ageView=46ormat); > Note that the weight field is missing in the resulting JSON: > =7B=22age=22:30, =22height=22:190=7D > =20 > =20 > =20 > =20 > -- > View this message in context: http://camel.465427.n5.nabble.com/Documen= tation-bug-at-http-camel-apache-org-json-html-tp5752215.html =20 > Sent from the Camel - Users mailing list archive at Nabble.com. > =20