title: How correctly produce JSON by RESTful web service?
body: <p>I am writing a web service the first time. I created a RESTful web service based on <a href="http://jersey.java.net">Jersey</a>. And I want to <strong>produce JSON</strong>. What do I need to do to generate the correct JSON type of my web service?</p>
  
  <p>Here's one of my methods:</p>
  
  <pre><code>@GET
  @Path("/friends")
  @Produces("application/json")
  public String getFriends() {
      return "{'friends': ['Michael', 'Tom', 'Daniel', 'John', 'Nick']}";
  }
  </code></pre>
  
  <p>Is it sufficient that I simply point out annotation <code>@Produces("application/json")</code> for my method? Then this method may return any type of object? Or only String? Do I need additional processing or transformation of these objects?</p>
  
  <p>Please help me as a beginner to deal with these issues. Thanks in advance!</p>