title: Java XStream with HashMap
body: <p>I want to use XStream to convert a java hash to a json hash.  I feel like this should be easier than it seems.  What I'm looking for is a way to make:</p>
  
  <pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  map.put("first", "value1");
  map.put("second", "value2");
  </code></pre>
  
  <p>become</p>
  
  <pre><code>{'first' : 'value1', 'second' : 'value2' }
  </code></pre>
  
  <p>The closes I have converts it into a series of arrays.</p>
  
  <pre><code>XStream xstream = new XStream(new JettisonMappedXmlDriver() {
      public HierarchicalStreamWriter createWriter(Writer writer) {
          return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
      }
  });
  
  xstream.toXML(map);
  </code></pre>
  
  <p>which becomes</p>
  
  <pre><code>[["first", "value1"], ["second", "value2"]]
  </code></pre>
  
  <p>I feel like converting a java hash to json hash should be straight forward.  Am I missing something?</p>