Notice, this is an array, not an array nested in an object. Any
Post by John YearyHello Arun,
That is very interesting. I would like to know what your solution
looks like since I have a similar problem that I have not had the time
to look at yet. I guess I should have read your post more carefully
about the client side.
John
____________________________
John Yeary
____________________________
<http://javaevangelist.blogspot.com/> <https://twitter.com/jyeary>
<http://www.youtube.com/johnyeary> <http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
<http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
<http://netbeans.org/people/84414-jyeary>
____________________________
"Far better it is to dare mighty things, to win glorious triumphs,
even though checkered by failure, than to take rank with those poor
spirits who neither enjoy much nor suffer much, because they live in
the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt
Thanks Tatu and John!
question was looking for some utility that can generate this class
for me by introspecting the JSON response. The service endpoint is
a well known endpoint and I only need this on the client-side so
@Produces and @Consumes will not be required.
Seems
Post by John YearyThere is an automatic mapping using POJO to JSON mapping. The
sufficient to provide automatic mapping for JSON, and XML with
@Consumes({MediaType.APPLICATION_JSON}). If you want to change
the default provider, or change the JSON mapping to something
like BadgerFish you need to change the JSONJAXBContext.
I am sure you already saw this, but I will post it anyway.
http://jersey.java.net/nonav/documentation/latest/json.html
John
____________________________
John Yeary
____________________________
<http://javaevangelist.blogspot.com/>
<https://twitter.com/jyeary> <http://www.youtube.com/johnyeary>
<http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
<http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
<http://netbeans.org/people/84414-jyeary>
____________________________
"Far better it is to dare mighty things, to win glorious
triumphs, even though checkered by failure, than to take rank
with those poor spirits who neither enjoy much nor suffer much,
because they live in the gray twilight that knows not victory nor
defeat."
-- Theodore Roosevelt
On Mon, Jan 9, 2012 at 9:15 PM, Tatu Saloranta
On Mon, Jan 9, 2012 at 6:01 PM, Arun Gupta
Post by Arun GuptaJersey Client API has to suck up a relatively complex JSON
document from a
Post by Arun GuptaREST endpoint. What are my options for mapping this JSON
document to a
Post by Arun Guptacorresponding 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.
Post by Arun GuptaUse org.json APIs ? Would be rather time consuming!
No there is no need for such extreme measures. :)
-+ Tatu +-
--
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta