users@jersey.java.net

[Jersey] Re: Returned String value is not encoded

From: Glen Mazza <gmazza_at_talend.com>
Date: Tue, 28 Feb 2012 13:27:00 -0500

You should declare that that method @Produces JSON:
http://java.net/projects/jersey/sources/svn/content/tags/jersey-1.11/jersey/samples/jacksonjsonprovider/src/main/java/com/sun/jersey/samples/jacksonjsonprovider/NonJAXBBeanResource.java?rev=5665
. Your example is a subset of the jacksonjsonprovider sample, so you
may wish to confirm that sample works with you first.

HTH,
Glen

On 02/28/2012 01:16 PM, Martin Ždila wrote:
> Hello
>
> I have method like this
>
> @GET
> public String getMessage() {
> return "Hello";
> }
>
>
> If I call it with Accept: application/json, I get a plain string
> without quotes. How to get properly encoded JSON string? With complex
> objects it works. I am using Jersey with Jackson.
>
> Thanks in advance.
>


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza