LINQ to JSon response

痴心易碎 提交于 2019-12-24 19:43:45

问题


I have posted my class below and with sample data. I need to pass this class as an json response.

[Serializable]
public class Student
{
    public string Fname {get;set;}
    public string FirstSemMarkcsv {get;set;}  //This should hold marks as comma separated values.
    public string SecondSemMarkcsv {get;set;}  //This should hold marks as comma separated values.
}

Sample Data

Fname     FirstSemMark       SecondSemMark
John               95                  90
John               80                  93
John               70                  80
Peter              60                  78
Peter              80                  80
Peter              90                  85

I need to pass this as json response.

Any thoughts please.

Regards,

Ashish


回答1:


List<Student> students = GetStudentList();
return Json(students));


来源:https://stackoverflow.com/questions/10106716/linq-to-json-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!