Chartjs-Passing Json using JsonResult not working properly

1👍

You should pass c# array to Json method, it will convert it to json itself:

var pieData= new[]
             {
                new { value = 40, color = "#000000" },
                new { value = 60,  color="#01dfde"},
                new { value=60, color = "#01dfde"}
              };
return Json(pieData, JsonRequestBehavior.AllowGet);

Leave a comment