title: How do I append objects to a JSON variable?
body: <p>The issue here is that the instance of the class "obj" is re-created every time I run through the loop so at the end of the loop, I only have 1 set of the object. It should have several.</p>
  
  <pre><code>foreach (var project in projectsDictionary)
  {
      foreach (var season in seasonsDictionary)
      {
          foreach (var episode in episodesDictionary)
          {
              obj = new Parent
              {
                  Title = project.Value, Link = "1", Children = new List&lt;Parent&gt;
                  {
                      new Parent
                      {
                          Title = season.Value, Link = "1", Children = new List&lt;Parent&gt;
                          {
                              new Parent
                              {
                                  Title = episode.Value, Link = "1", Children = null
                              }
                          }
                      }
                  }
              };
          }
      }
  }
  
  var responseBody = JsonConvert.SerializeObject(obj);
  return responseBody;
  
  public class Parent
  {
      public string Title
      {
          get;
          set;
      }
  
      public string Link
      {
          get;
          set;
      }
  
      public List&lt;Parent&gt; Children
      {
          get;
          set;
      }
  }
  </code></pre>