users@jersey.java.net

[Jersey] Ignoring null elements in JSON

From: viraj <raj_vid_at_yahoo.com>
Date: Wed, 23 Mar 2011 11:48:01 -0700 (PDT)

Hi,

I am using the JAXBContextResolver for configuring JSON with mapped builder.
We have the requirement in our project in which i have to ignore the
elements which has null values in it. I tried using other notations like
natural and mapped Jettison. But with Jettison the null value gets converted
into an emtpy string.For eg I am getting-
{"Person":{"givenName":"xxxx","familyName":"yyyy","middleName":null}}

But as middleName is null I want to ignore it and I want like this -

{"Person":{"givenName":"xxxx","familyName":"yyyy"}}

Can anybody please help me how we can achieve this in JAXBCOntextResolver.

Thanks
Viraj

--
View this message in context: http://jersey.576304.n2.nabble.com/Ignoring-null-elements-in-JSON-tp6201480p6201480.html
Sent from the Jersey mailing list archive at Nabble.com.