title: Jackson List<Object> to String
body: <p>I created the following web service just to learn:</p>
  
  <pre><code>@GET
  @Path("/tmp/uno")
  @Produces(MediaType.APPLICATION_JSON)
  public ArrayList&lt;Object&gt; getData() { 
      KeyValue&lt;Integer, Integer&gt; kv = new KeyValue&lt;&gt;(1, 2);
  
      List&lt;KeyValue&gt; list = new ArrayList&lt;&gt;();
      list.add(kv);
  
      **return new ArrayList&lt;Object&gt;(list);**
  }
  </code></pre>
  
  <p>I'm doing the cast just for testing purposes and I'm getting the following error:</p>
  
  <pre><code>sep 20, 2017 5:53:17 PM org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo
  SEVERE: MessageBodyWriter not found for media type=application/json, type=class java.util.ArrayList, genericType=java.util.ArrayList&lt;java.lang.Object&gt;.
  </code></pre>
  
  <p>If I don't cast the list</p>
  
  <pre><code>@GET
  @Path("/tmp/uno")
  @Produces(MediaType.APPLICATION_JSON)
  public **List&lt;KeyValue&gt;** getData() { 
      KeyValue&lt;Integer, Integer&gt; kv = new KeyValue&lt;&gt;(1, 2);
  
      List&lt;KeyValue&gt; list = new ArrayList&lt;&gt;();
      list.add(kv);
  
      **return list;**
  }
  </code></pre>
  
  <p>I get the following response:</p>
  
  <pre><code>[
      {
          "key": {
              "type": "int",
              "value": 1
          },
          "value": {
              "type": "int",
              "value": 2
          }
      }
  ]
  </code></pre>
  
  <p>I have two questions
  1.- Why I cant responde a list of Objects?
  2.- Why each property has its datatype in the jSON?</p>
  
  <hr>
  
  <p>The keyValue class is the following:</p>
  
  <pre><code>public class KeyValue&lt;X, Y&gt; {
  private X key; 
  private Y value;
  
  public KeyValue() {
      // Auto-generated constructor stub
  }
  
  public KeyValue(X key, Y value) {
      this.key = key;
      this.value = value;
  }
  
  public X getKey() {
      return key;
  }
  
  public Y getValue() {
      return value;
  }
  
  public void setKey(X key) {
      this.key = key;
  }
  
  public void setValue(Y value) {
      this.value = value;
  }
  }
  </code></pre>
  
  <p>My Jackson dependency is:</p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
          &lt;version&gt;2.26&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>