I am executing a linq query which gets me all the records from a table:
var data = _context.People.ToList(); //_context is my DataContext.
The above returns the the value:
{
"name": "john",
"age": "30"
},
{
"name": "jane",
"age": "31"
}
but according to jsonlint, this is invalid and I need to have it be returned as:
[{
"name": "john",
"age": "30"
},
{
"name": "jane",
"age": "31"
}]
How can I do this?
viewData.xldata = [];
$.each(data, function(i, row) {
var strRow = JSON.stringify(row);
viewData.xldata.push(strRow);});
Deserialize using `JavaScriptSerializer:
var people = jss.Deserialize<List<People>>(args["xldata"]);