title: ASP.NET MVC 5 Controller JsonResult Internal Server Error
body: <p>Why do I get a <code>500 Internal server error</code>?</p>
  
  <p>C#</p>
  
  <pre><code> public JsonResult GetCategory(string id)
          {
                  long eocategoryid = Convert.ToInt64(id);
                  dbEntities db = new dbEntities();
                  ttCategory cat = db.ttCategories.First(x =&gt; x.ID == eocategoryid);
  
                  return Json(new
                  {
                      catgeory = cat
                  }, JsonRequestBehavior.AllowGet);
  
   }
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code> $.ajax({
                       type: "GET",
                       url: "/GetCategory",
                       data: { id: data.node.a_attr.id },
                       datatype: "json",
                       success: function (data) {
                           console.log(data);
                      }
                   });
  </code></pre>