title: Using Gson and JsonObject to format and parse data
body: <p>I am using <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/JsonObject.html">JsonObject</a> and <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/index.html">Gson</a> to format the data i need to send in the form of String and then retrieve and parse it somewhere else. 
  This is my simple code which is not working:</p>
  
  <pre><code>public static void main(String[] args) 
  {
  
      Gson g = new Gson();
      Gson listG = new Gson();
      ArrayList&lt;String&gt; l= new ArrayList&lt;String&gt;();
      l.add("abcd");
      l.add("efgh");
      l.add("ijkl");
  
      String list = listG.toJson(l);
  
      JsonObject jObject = new JsonObject();
      jObject.addProperty("command" , 1);
      jObject.addProperty("message" , "this is a test message");
      jObject.addProperty("list" , list);
  
      String toSend = g.toJson(jObject);
      System.out.println(toSend);  
  
      Gson rec = new Gson();
      JsonObject newObj = rec.fromJson(toSend, JsonObject.class);
      System.out.println(newObj);  // getting nothing in newObj
  
  
  }
  </code></pre>
  
  <p>What am i doing wrong here?</p>