title: Invalid JSON primitive when sending POST request
body: <p>I have the following ajax request in which I'm trying to send a JSON Object to the server:</p>
  
  <pre><code>function sendData(subscriptionJson) {
  
  
  
  
                  $.ajax({
                      type: "POST",
                      url: '@Url.Action("SubscribeSecurities", "Subscription")',
                      data: "{'subscriptions': subscriptionJson}",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: function (response) {
                          console.log("success response: " + response.responseText);
                          alert("Hello: " + response.Name + " .\nCurrent Date and Time: " + response.DateTime);
  
                      },
                      failure: function (response) {
                          console.log("failure response: " + response.responseText);
                          alert(response.responseText);
                      },
                      error: function (response) {
                          console.log("error response: " + response.responseText);
                          alert(response.responseText);
                      }
                  });
  
  
              }
  </code></pre>
  
  <p>Based on the top answer in <a href="https://stackoverflow.com/questions/2445874/invalid-json-primitive-in-ajax-processing">this post</a> I added quotes around the "data" attribute, but I'm getting an error saying that the "subscriptionJSON" isn't being recognized. I tried testing with a sample string as is done in the post: data: <code>"{'foo':'foovalue', 'bar':'barvalue'}",</code> but when the controller gets the parameter of the subscriptionJson object it is null. </p>
  
  <p><em>What is the official way to send a JSON object via a POST request to an ASP .NET MVC controller?</em></p>