I have a question for you stackoverflow experts :). I’m planning to use the FLOT jQuery plugin to chart some data to the MVC3 application I’m building.
I have several views that return data, but I’m just using a resultset and not an entity framework of any sort (it’s nice and fast). I’ve never worked with JSON before, and I have the following questions:
a) Do I have to use a data model to return data to the controller, then use the JSON method to create the JSON file, or can I return the data without using an entity framework and achieve the same result?
b) Is there a bit of sample code anywhere that can help me out with this (or a link to a good example?
Many thanks in advance ;-).
If you can get your data into a class with properties (get;set;) then you can simply use the built in serializer for MVC ie return Json(yourClass);
If you want a bit more control over it, check out
http://json.codeplex.com/
Theres a linq-to-json and a dataset converter as well.