title: JSON parsing error syntax error unexpected end of input
body: <p>I got the following piece of code</p>
  <pre><code>function pushJsonData(productName) {
      $.ajax({
          url: &quot;/knockout/SaveProduct&quot;,
          type: &quot;POST&quot;,
          contentType: &quot;application/json&quot;,
          dataType: &quot;json&quot;,
          data: &quot; { \&quot;Name\&quot; : \&quot;AA\&quot; } &quot;,
          async: false,
          success: function () {
              loadJsonData();   
          },
          error: function (jqXHR, textStatus, errorThrown) {
            alert(textStatus + &quot; in pushJsonData: &quot; + errorThrown + &quot; &quot; + jqXHR);
          }
      });
  }
  </code></pre>
  <p>Notice that I hard coded the data value. The data get pushed into the database fine. However, I keep getting the error</p>
  <blockquote>
  <p>parsing error syntax error unexpected end of input</p>
  </blockquote>
  <p>I am sure my data is in correct JSON syntax. When I checked with on Network of Chrome inspector the saveProduct request showed the data is correct.</p>
  <pre><code>{ &quot;Name&quot;: &quot;AA&quot; }
  </code></pre>
  <p>This POST request did not have response. So I am clueless as to where the parse error was coming from. I tried using FireFox browser. the same thing happened.</p>
  <p>Can anyone give some idea as to what is wrong?</p>
  <p>Thanks,</p>
  <p>P.S.
  Here is the controller code</p>
  <pre><code>namespace MvcApplJSON.Controllers
  {
      public class KnockoutController : Controller
      {
          //
          // GET: /Knockout/
  
          public ActionResult Index()
          {
              return View();
          }
  
          [HttpGet]
          public JsonResult GetProductList()
          {
              var model = new List&lt;Product&gt;();
              try
              {
                  using (var db = new KOEntities())
                  {
                      var product = from p in db.Products orderby p.Name select p;
                      model = product.ToList();
                  }
              }
              catch (Exception ex)
              { throw ex; }
              return Json(model, JsonRequestBehavior.AllowGet);
          }
          [HttpPost]
          public void SaveProduct (Product product)
          {
              using (var db = new KOEntities())
              {
                  db.Products.Add(new Product { Name = product.Name, DateCreated = DateTime.Now });
                  db.SaveChanges();
              }
          }
      }
  }
  </code></pre>