[Jersey] Returned String value is not encoded

From: Martin Ždila <>
Date: Tue, 28 Feb 2012 19:16:10 +0100


I have method like this

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.

Ing. Martin Ždila