title: jersey web service json utf-8 encoding
body: <p>I made a small Rest webservice using Jersey 1.11. When i call the url that returns Json, there are problems with the character encoding for non english characters. The corresponding url for Xml ("test.xml" makes it utf-8 in the starting xml-tag.</p>
  
  <p>How can I make the url "test.json" return utf-8 encoded response?</p>
  
  <p>Here's the code for the service:</p>
  
  <pre><code>@Stateless
  @Path("/")
  public class RestTest {   
      @EJB
      private MyDao myDao;
  
      @Path("test.xml/")
      @GET
      @Produces(MediaType.APPLICATION_XML )
      public List&lt;Profile&gt; getProfiles() {    
          return myDao.getProfilesForWeb();
      }
  
      @Path("test.json/")
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      public List&lt;Profile&gt; getProfilesAsJson() {
          return myDao.getProfilesForWeb();
      }
  }
  </code></pre>
  
  <p>This is the pojo that the service uses:</p>
  
  <pre><code>package se.kc.mimee.profile.model;
  
  @XmlRootElement
  public class Profile {
      public int id;
      public String name;
  
      public Profile(int id, String name) {
          this.id = id;
          this.name = name;
      }
  
      public Profile() {}
  
  }
  </code></pre>