users@jersey.java.net

[Jersey] Handling JSON with null elements

From: viraj <raj_vid_at_yahoo.com>
Date: Thu, 24 Mar 2011 11:54:54 -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. With Jettison, the null value gets converted
into an emtpy string.But I don't want that element itself in the output.
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/Handling-JSON-with-null-elements-tp6205301p6205301.html
Sent from the Jersey mailing list archive at Nabble.com.