users@jersey.java.net

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

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Mon, 9 Jan 2012 18:15:18 -0800

On Mon, Jan 9, 2012 at 6:01 PM, Arun Gupta <arun.p.gupta_at_oracle.com> wrote:
> Jersey Client API has to suck up a relatively complex JSON document from a
> REST endpoint. What are my options for mapping this JSON document to a
> corresponding JAXB class ?

Do you actually need a JAXB (annotated) class? Or just a regular POJO?

If POJO, just write it to match structure of JSON -- after all, JSON
is object notation, meaning that there is natural correlation between
POJO properties, JSON data.

And even for JAXB basic POJOs typically work fine; annotations are
mostly needed to override default behavior.

> Use org.json APIs ? Would be rather time consuming!

No there is no need for such extreme measures. :)

-+ Tatu +-