Gurmeet Singh

Gurmeet Singh

  • NA
  • 176
  • 39.8k

Exception occurs when deserialize json data

Nov 28 2016 6:39 AM
Object reference not set to an instance of an object when deserialize json data
 
public ActionResult GetBill(string[] jdata)
{

List datax1 = JsonConvert.DeserializeObject>(jdata.ToString());
return view("GetBill");
}
$scope.genbil = function () {
//alert(angular.toJson($scope.itemslst));
//var jdata = ["role1", "role2", "role3"];
var jdata =[angular.toJson($scope.itemslst)];
alert(jdata);
jQuery.ajax({
type: "POST",
url: "/CustomerItem/GetBill",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(jdata),
success: function (data) { alert(data); },
failure: function (errMsg) {
alert(errMsg);
}
});
Please anyone can help me.

Answers (3)