users@jersey.java.net

[Jersey] Re: JSON document -> JAXB class ?

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Tue, 10 Jan 2012 13:17:52 -0800

Thanks Tatu!

Any suggestions on how this "XMLism" can be avoided with Jersey ?

-Arun

On 1/10/12 12:44 PM, Tatu Saloranta wrote:
> On Tue, Jan 10, 2012 at 11:27 AM, Arun Gupta <arun.p.gupta_at_oracle.com
> <mailto:arun.p.gupta_at_oracle.com>> wrote:
>
> The endpoint is returning the response as:
>
> [
> { },
> { },
> { }
> ]
>
> Notice, this is an array, not an array nested in an object. Any
> suggestions on how the client-side POJO could look like ?
>
> List<Pojo> or Pojo[] from a JAX-RS endpoint return JSON like:
>
> {"pojo"
> :
> [{"id":"10","text":"some text"},{"id":"20","text":"more text"}]
> }
>
>
>
> Possibily, but not necessarily: this wrapping is only done by some
> conventions. POJO mapping for example would not add extra "pojo"
> property, but rather return array as is. Adding wrapping is an
> "XMLism", since it is required with XML; but it is not required from
> JSON perspective; and as such this is done by libraries that use XML APIs.
>
> -+ Tatu +-
>

-- 
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta