users@jersey.java.net

Re: [Jersey] JSON in Jersey

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Sun, 28 Feb 2010 16:44:56 +0100

you need natural notation...........

http://weblogs.java.net/blog/felipegaucho/archive/2010/02/25/jersey-feat-jquery-jsonp

On Sun, Feb 28, 2010 at 4:24 PM, John Lister <john.lister_at_kickstone.com> wrote:
> Hi, sorry if this is the wrong place to ask...
>
> I'm outputtng JSON via my Jersey resources, but I would like the JSON to
> include null values.
> For example I would like something like:
> {
>  aValue: "123",
>  nullValue: null,
> }
>
> but at the minute the nulls are stripped and I get this:
> {
>  aValue: "123",
> }
>
> I tried using @XMLElement and specifying nillible and required, the latter
> didn't make a difference and former gives me something like:
>
> {
>  aValue: "123",
>  nullValue: {
>       "@nill": "true",
>  }
> }
>
> Is there a way to achieve what I want?
> One thing is that I'm using the default notation as I haven't managed to get
> the natural notation to work yet, would switching work?
>
> Thanks
>
>
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>



-- 
------------------------------------------
   Felipe Gaúcho
   10+ Java Programmer
   CEJUG Senior Advisor