title: json object binding in MVC
body: <p>I seem to be having a problem passing a javascript object, which contains an array, to my MVC controller. I have an object which contains two strings, and a string array. The two strings bind correctly, but as soon as I add an array to the obect I get the following error:</p>
  
  <p>Collection is read-only.</p>
  
  <p>Here is my JS + Ajax code:</p>
  
  <pre><code>   $('.submit').on('click', function() {
  
          var viewModel = {
              FName: "John",
              LName: "Doe",
              DaysOfTheWeek: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
          };
  
          console.log(viewModel);
  
          $.ajax({
              url: "/Home/JsonMethod",
              type: "POST",
              data: JSON.stringify(viewModel),
              dataType: 'json',
              contentType: 'application/json; charset=utf-8',
              success: function (data) {
                  console.log(data);
              }
          });
  
      });
  </code></pre>
  
  <p>Here is my MVC controller:</p>
  
  <pre><code>    public JsonResult JsonMethod(Person person)
      {
          return Json(person, JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>Here is the Person class:</p>
  
  <pre><code>    public class Person
      {
          public string FName { get; set; }
          public string LName { get; set; }
          public string[] DaysOfTheWeek { get; set; }
  
          public Person()
          {
              DaysOfTheWeek = new string[7];
          }
      }
  </code></pre>
  
  <p>I've had a look online, but I can't find anything that deals with the following issue. Any help with this matter would be great.</p>