On May 29, 2009, at 3:41 PM, Ronak Patel wrote:
> Paul,
>
> So the below code is the way you go about unmarshalling JSON using
> JAXB? I couldn't find much documentation about this...
>
See the following samples
http://download.java.net/maven/2/com/sun/jersey/samples/json-from-jaxb/1.1.0-ea/json-from-jaxb-1.1.0-ea-project.zip
http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.1.0-ea/jaxb-1.1.0-ea-project.zip
See the JSON chapter of the users guide:
https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html#json
Hope this helps,
Paul.
> Ronak
>
> From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
> To: users_at_jersey.dev.java.net
> Sent: Friday, May 29, 2009 2:42:21 PM
> Subject: Re: [Jersey] Consume JSON REST Web Services using Jersey
>
> Hi Ronak,
>
> You can use JAXB if you wish, but you can also use other types like
> JSONObject or JSONArray.
>
> Or you could use the support provided by Jackson:
>
> http://jackson.codehaus.org/Download
>
> It really depends on how you want to process the JSON.
>
> Paul.
>
> On May 29, 2009, at 2:28 PM, Ronak Patel wrote:
>
>> All,
>>
>>
>> How can I use Jersey to consume JSON REST Web Services?
>>
>>
>> Can the below code be used to consume JSON services? Is the Entity
>> supposed to be a JAXB annotated bean?
>>
>>
>> final WebResource resource = Client.create().resource("http://localhost/serviceurl
>> ");
>>
>> final Builder resourceBuilder =
>> resource
>> .queryParams(queryParams).accept(MediaType.APPLICATION_JSON_TYPE);
>>
>>
>> final ClientResponse response =
>> resourceBuilder.get(ClientResponse.class);
>>
>> response.getEntity(...);
>>
>>
>> Ronak
>>
>>
>>
>
>
>