title: Sending array of Json data along with image file with ajax in asp.net mvc
body: <p>I am trying to send array of json data and image file with ajax but i can only get image file and not getting json data and i can see json data sent properly in fiddler though.In action method, collection parameter for json data  says count=0. How can i get array of json data?</p>
  
  <pre><code>@using (Ajax.BeginForm("GetData", "Home", new AjaxOptions
  {
      InsertionMode = InsertionMode.Replace
  }, new { @id = "form_", enctype = "multipart/form-data" }))
  {
      @Html.TextBox("imagefile", null, new { @type="file"})
      @Html.Hidden("formdata", null, new { @data_formdatajson = "" }))
      @Html.TextBox("submit", null, new { @id = "button", @value = "upload", @type = "submit"})
  }
  
      var DataClass = {
              data1: data1value,
              data2: data2value
          }
  
  dataArray=[];
  dataArray.push(DataClass);
  dataArrayJson = JSON.stringify(dataArray);
  $('#formdata’).data("formdatajson ", dataArrayJson);
  
             $('#form_').on('submit', function (e) {
                  var dataArray_ = $('#formdata ').data("formdatajson");
                  var formdata = new FormData($(this)[0]);
                  formdata.append('formdata', dataArray_);
                          $.ajax({
                              url: '/GetData/Home/',
                              type: 'POST',
                              data: formdata,
                              processData: false,
                              contentType: false,
                              dataType: "json",
                              success: function (data) {
                              },
                              error: function () { },
                          });
                      });
  public class DataClass
  {
       public string data1 { get; set; }
          public string data2 { get; set; }
  }
  
          [HttpPost]
          public JsonResult GetData(IEnumerable&lt;DataClass&gt; formdata, HttpPostedFileBase imagefile)
          {
                      return Json(new { success = true },  JsonRequestBehavior.AllowGet);
          }
  </code></pre>