Your problem is with rootunwrapping and notation mapping, here's a pointer
to what you need to
know<
http://jersey.java.net/nonav/documentation/latest/json.html>
.
On Mon, Sep 3, 2012 at 5:02 PM, Pulkit Singhal <pulkitsinghal_at_gmail.com>wrote:
> On Mon, Sep 3, 2012 at 4:54 PM, Pulkit Singhal <pulkitsinghal_at_gmail.com>wrote:
>
>> My Jersey resource acts as the middle tier.
>> It collects xml data from a 3rd party and serializes it back to my
>> clients as JSON.
>>
>
> EDIT, the code example should actually look like this:
> @Produces(MediaType.
> APPLICATION_JSON)
> public Product[] getProducts() {
> ...
> return webResource
> .method("GET", new GenericType<List<Product>>(){})
> *.toArray(new Product[0])*;
> }
>
>
> But the JSON it returns isn't quite what I would expect to get:
>> {
>> "Product[]":[
>> {...},
>> {...}
>> ]
>> }
>>
>> There's an artificial key "Product[]" which I would rather name something
>> like "products" ... is there some way to take control of this in Jersey?
>>
>
>