[Chartjs]-Updating chart.js with JSON from Razor page

1👍

JsonResult "formats the given result as JSON."

By giving it a JSON string, you end up sending a double-serialized value to the browser. So even after jQuery deserializes it, you still end up with a string rather than an object.

So rather than passing JsonResult the serialized string representation, just give it the object you want to have serialized.

return new JsonResult(ds);

Leave a comment