title: json.net list serialization to JSON Array
body: <p>I'm using json.net to serialize an object to a json string. Now I have a list of Objects which I like to serialize into a Json array. However, I'm unable to do that with json.net and hope someone can point out my mistake.</p>
  
  <p>I have the following classes:</p>
  
  <pre><code>class PeopleList {
      public Person inputs { get; set; }
  }
  
  class Person {
      public String name { get; set; }
      public int age { get; set; }
  }
  </code></pre>
  
  <p>I'm using the following code to serialize the objects:</p>
  
  <pre><code>var json = new List&lt;PeopleList&gt;();
  Person p1 = new Person { name = "Name 1", age = 20 };
  json.Add(new PeopleList { inputs = p1 });
  Person p2 = new Person { name = "Name 2", age = 30 };
  json.Add(new PeopleList { inputs = p2 });
  
  
          string jsonString = JsonConvert.SerializeObject(json, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented });
  </code></pre>
  
  <p>This gives me the following output:</p>
  
  <pre><code>[
    {
      "inputs": {
        "name": "Name 1",
        "age": 20
      }
    },
    {
      "inputs": {
        "name": "Name 2",
        "age": 30
      }
    }
  ]
  </code></pre>
  
  <p>Here is what I actually want:</p>
  
  <pre><code>[
    {
      "inputs": [
        {
          "name": "Name 1",
          "age": 20
        }
      ]
    },
    {
      "inputs": [
        {
          "name": "Name 2",
          "age": 30
        }
      ]
    }
  ]
  </code></pre>
  
  <p>As you see I need every object in my list encapsulated with []. How can I achieve that with Json.net? Thanks!</p>