users@jersey.java.net

[Jersey] JSON Arrays issue in Pet Catalog sample app

From: Gautam Arora <gautamsarora_at_gatech.edu>
Date: Sun, 1 Mar 2009 15:24:00 -0800 (PST)

Hi,
I'm following the RESTful Pet Catalog tutorial from
http://weblogs.java.net/blog/caroljmcdonald/archive/2008/08/a_restful_pet_c_1.html

The expected JSON response (as per the tutorial is)
http://localhost:8080/catalog/resources/items/

{"items":{"@uri":"http://localhost:8080/catalog/resources/items","item":[{
etc etc

but I get the response as:
{"@uri":"http://localhost:8080/catalog/resources/items","item":[{ etc etc

The "items" label is dropped.
I've read here on forum posts that say that dropping off the root element is
a desired feature and with newer releases of jersey it should be
fixed(/configurable?)

I've developed the app myself and also tested the same app by downloading it
and running it and and running into the same issue.

I'm using Jersey 1.0. Is this issue fixed in 1.0.2?

Whats the best way to make jersey1.0 generate the "items" label for this
app? I've read on posts that we need to add a property for the json
unwrapping but cant figure out where/how to put it in the pet catalog sample
app.

I need this as I'm using YUI which expects this and throws an invalid label
error otherwise
As per the tutorial, having the label is the expected behavior, so any
reasons why I could be missing it?

Thanks,
Gautam
-- 
View this message in context: http://n2.nabble.com/JSON-Arrays-issue-in-Pet-Catalog-sample-app-tp2406690p2406690.html
Sent from the Jersey mailing list archive at Nabble.com.