title: Android gson serialization issue
body: <p>I have HttpPost request on my Android application to my .NET Web Api.</p>
  
  <p>I am using json data type and <a href="http://code.google.com/p/google-gson/" rel="nofollow">gson</a> class in order to serialize my object.</p>
  
  <p>Here is my code about serialization:</p>
  
  <pre><code>    HttpPost post = new HttpPost();
      post.setURI(new URI("my url goes here"));
      HashMap&lt;String, String&gt; hashMap = new HashMap&lt;String, String&gt;();
      hashMap.put("username", username);
      hashMap.put("userCredentials", new Gson().toJson(credentials, UCredentials.class));
      // username and credentials are parameters.
      post.setHeader("Content-Type", "application/json; charset=utf-8");
      post.setEntity(new StringEntity(new Gson().toJson(hashMap)));
  
      DefaultHttpClient httpClient = new DefaultHttpClient();
      HttpResponse httpResponse = httpClient.execute(post);
      if (httpResponse.getStatusLine().getStatusCode() == 200) {
          // If successful.
      }
  </code></pre>
  
  <p>Except <code>hashMap.put("userCredentials", new Gson().toJson(credentials, UCredentials.class));</code> code line everything works fine. But with this line...</p>
  
  <p>Gson class gives me json as:</p>
  
  <pre><code>{
      "userCredentials":
          "{
              \"emailOrUsername\":\"asd@sadas.com\",
              \"password\":\"113\"
           }",
      "username":"sdggfsdgf"
  }
  </code></pre>
  
  <p>and it is not valid json pattern. I need json output like:</p>
  
  <pre><code>{
          "userCredentials":
              {
                  "emailOrUsername":"asd@sadas.com",
                  "password":"113"
              },
          "username":"sdggfsdgf"
  }
  </code></pre>
  
  <p>What should I do to achieve this?</p>
  
  <p>Thanks in advance.</p>