title: JAX-RS, Map<String,String> to JSON without the overhead?
body: <p>I'm using JAX-RS to create restful webservices in Java. I am getting to much overhead in the produced JSON.</p>
  
  <p>Data class:</p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Test {
  
      private Map&lt;String,String&gt; data;
  
      Test() {}
  
      public Test(Map&lt;String,String&gt; data) {
          this.data = data;
      }
  
      public Map&lt;String, String&gt; getData() {
          return data;
      }
  }
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>@GET
  @Path("/test")
  @Produces("application/json; charset=UTF-8;")
  public Test test() {
     Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;();
     map.put("foo", "bar");
     map.put("bingo", "bongo");
     return new Test(map);
  }
  </code></pre>
  
  <p>Produces:</p>
  
  <pre><code>{"data":{"entry":[{"key":"foo","value":"bar"},{"key":"bingo","value":"bongo"}]}}
  </code></pre>
  
  <p>I would like it to produce:</p>
  
  <pre><code>{"data":{"foo":"bar","bingo":"bongo"}}
  </code></pre>
  
  <p>What is the simplest way to achive this? I am free to redifine my data class but I can't know in advance the keys or size of the map.</p>