title: How to deserialize multiple JSON objects in C#?
body: <p>I'm passing multiple JSON objects from my frontend to a C# backend - how can I deserialize them into C# classes so they can be used later on in my application?  Before I go any farther, I am tied to using the JS <code>FormData</code> object, <code>contentType: false</code>, and <code>processData: false</code>, because I also need to pass files via this AJAX call; that is completely unrelated to this question.  Here's my code so far:</p>
  
  <p><strong>Frontend - function is called when a submit button is pressed</strong></p>
  
  <pre><code>submitData: function () {
      var formCollection = this.appModel.get('formCollection').models;
      var formData = new FormData();
      var formJson = [];
      $.each(formCollection, function (index, form) {
          var tempJson = {};
          if (form) {
              tempJson['id'] = form.get('id');
              tempJson['number'] = form.get('number');
              tempJson['name'] = form.get('name');
              tempJson['attachments'] = form.get('attachments');
              formJson.push(tempJson);
          }
      });
      console.log(JSON.stringify(formJson));
      formData.append('formJson', JSON.stringify(formJson));
      $.ajax({
          type: "POST",
          url: '/NMISProduct/Test',
          contentType: false,
          processData: false,
          data: formData,
          success: function (result) {
              console.log(result);
          }
      });
  }
  </code></pre>
  
  <p><strong>JSON.stringified data that's being passed</strong></p>
  
  <pre><code>[{"id":1,"number":null,"name":"Investment Portfolio Statement","attachments":null},{"id":2,"number":"61-0227","name":"WMC Signature Portfolio Agreement","attachments":null},{"id":3,"number":"61-1126","name":"WMC Signature Choice Agreement","attachments":null},{"id":4,"number":"61-1162","name":"WMC Signature Annuities Agreement","attachments":null},{"id":5,"number":"61-1205","name":"WMC Signature Managed Accounts Client Agreement","attachments":null}]
  </code></pre>
  
  <p><strong>C# MVC 5 Backend</strong></p>
  
  <pre><code>[HttpPost]
  public async Task&lt;JsonResult&gt; Test()
  {
      Debug.WriteLine(Request.Params["formJson"]);
      var forms = JsonConvert.DeserializeObject&lt;Form&gt;(Request.Params["formJson"]);
      Debug.WriteLine(forms);
      try
      {
          var srNumber = GetSRNumber();
          foreach (string file in Request.Files)
          {
              var fileContent = Request.Files[file];
              Debug.WriteLine(ReadFileInputStream(fileContent));
              if (fileContent != null &amp;&amp; fileContent.ContentLength &gt; 0)
              {
                  // get a stream
                  var stream = fileContent.InputStream;
                  // and optionally write the file to disk
                  //var fileName = Path.GetFileName(file);
                  var fileName = fileContent.FileName;
                  var path = Path.Combine(Server.MapPath("~/App_Data/"), fileName);
                  using (var fileStream = System.IO.File.Create(path))
                  {
                      stream.CopyTo(fileStream);
                  }
              }
          }
      }
      catch (Exception)
      {
          return Json("Upload failed");
      }
      return Json("File uploaded successfully");
  }
  
  public class Form
  {
      public int id { get; set; }
      public string number { get; set; }
      public string name { get; set; }
      public Form attachments { get; set; }
      public byte[] fileAsBytes { get; set; }
  }
  </code></pre>
  
  <p>I've done my research and found several Stackoverflow questions that show how to serialize one JSON object into one C# class - however, I need to serialize multiple JSON objects into a <code>List&lt;Form&gt;</code>.  How can I do this?  What am I doing wrong in the posted code?</p>