title: gson - include class name when serializing java pojo -> json
body: <p>Using <a href="http://sites.google.com/site/gson/Home" rel="noreferrer">GSON</a> how do I append the class name of my List to my outputted json string? I've looked through the <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/index.html" rel="noreferrer">api</a> and have missed any reference to do this. I'm using <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/GsonBuilder.html" rel="noreferrer">GsonBuilder</a> in my real code but don't see any options for it either.</p>
  
  <pre><code>public class Person {
    String name;
  
    public Person(String name){
      this.name = name;
    }
  
    public static void main(String [] args){
      Person one = new Person("Alice");
      Person two = new Person("Bob");
  
      List&lt;Person&gt; people = new ArrayList&lt;Person&gt;();
      people.add(one);
      people.add(two); 
  
      String json = new Gson(people);
    }
  }
  </code></pre>
  
  <p>This gives the following output: </p>
  
  <blockquote>
    <p>json = [{"name": "Alice"},{"name": "Bob"}]</p>
  </blockquote>
  
  <p><strong>How do I achieve the following output?</strong> or something similar.</p>
  
  <blockquote>
    <p>json = {"person":[{"name": "Alice"},{"name": "Bob"}]}  </p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>json = [{"person":{"name": "Alice"}},{"person":{"name": "Bob"}}] </p>
  </blockquote>
  
  <p>Hope it's something trivial that I have just missed. Thanks in advance.</p>