title: Jersey 2.26 REST API - Json return not working
body: <p>I have this simple example to return a list of User in JSON. It works fine with XML, but not working with JSON.
  Not sure what I'm doing wrong. Is there anything else I need to do?
  I created the project using jersey-quickstart (maven) and uncommented the dependency to support JSON.</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-json-binding&lt;/artifactId&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>On my User domain I have the @XmlRootElement annotation and there are just 2 fields. Id (long) and Username (String)</p>
  
  <p>And that's what I have on my resource:</p>
  
  <pre><code>@GET
      @Produces(MediaType.APPLICATION_JSON)
      public List&lt;User&gt; getUsers(){
          return userService.getAllUsers();
      }
  </code></pre>
  
  <p>And that's what I have on my service:</p>
  
  <pre><code>public List&lt;User&gt; getAllUsers(){
          List&lt;User&gt; users = new ArrayList&lt;User&gt;();
  
          User u1 = new User(1l, "user_1");
          User u2 = new User(2l, "user_2");
          User u3 = new User(3l, "user_3");
  
          users.add(u1);
          users.add(u2);
          users.add(u3);
  
          return users;
      }
  </code></pre>
  
  <p>By changing the APPLICATION_JSON to APPLICATION_XML it works fine and return the xml with the list of users. With APPLICATION_JSON I get this:</p>
  
  <pre><code>SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.List&lt;com.wordpress.whiteboardcoding.agenda.domain.User&gt;.
  </code></pre>
  
  <p>Not sure if there is something else I had to do other then uncommenting the jersey-media-json-binding. Any thoughts?</p>
  
  <p>Trying to find out if there is something different as it's not using the jersey-media-moxy anymore.</p>
  
  <p>Thanks!</p>