users@jersey.java.net

RE: [Jersey] Set the root when returning a collection

From: Jeremy Whitlock <jwhitlock_at_collab.net>
Date: Thu, 13 Nov 2008 10:00:45 -0800

Paul,
        Thanks for taking the time to understand what I was saying. I'm
glad we agree as well because now I don't feel so bad bringing it up.
Just in case I wanted to hack up a patch, how do you see something like
this working?

Take care,

Jeremy

> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Thursday, November 13, 2008 1:52 AM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] Set the root when returning a collection
>
>
> On Nov 12, 2008, at 11:05 PM, Jeremy Whitlock wrote:
>
> >> Just curious if you have only one person item in your array.
> >
> > No. I had 3 items in the array, each fully initialized so that all
> > member variables were non-null. The actual type being serialized
was
> > List<Person>, which behind the scenes was ArrayList<Person>.
> >
> >> By default the JSON support always strips out the root element, so
it
> >> is never encoded in JSON.
> >
> > That's what I'm wondering...can we make it configurable with a
> > property
> > or something.
>
> Yes, it is a bug. The JSON list writer is not checking the
> configuration properties of the JSON specific marshaler if utilized
> via the JSONJAXBContext [1].
>
>
> > I think readability is adversely affected, or it can be
> > depending on who the reader is. ;) Regardless, assuming one way or
> > another is just begging for at least someone to get upset.
> >
>
> :-) agreed what we are finding from the JSON feedback is that
> developers want to customize, but we can also greatly improve the out-
> of-the-box configuration to reduce customization.
>
>
> > I also think that the side effect related to XML is a good candidate
> > for
> > a configurable property. Assuming that the root node should be
> > capitalized might not fly with everyone.
> >
>
> Agreed, plus english is not the only language (even if XML 1.0 some
> what restricts the unicode characters in XML element and attribute
> names). My assumption was that developers could specifically customize
> by creating a wrapping JAXB bean, but i think there are configuration
> options that can equally apply here to.
>
> Paul.
>
> [1]
>
https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-
> 1.0/api/jersey/com/sun/jersey/api/json/JSONJAXBContext.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net