有没有一种简单的方法可以用通过AJAX传递的JSON对象填充我的C#对象?
这是使用JSON从页面传递给C#WEBMETHOD的JSON对象.严格化
{
"user": {
"name": "asdf",
"teamname": "b",
"email": "c",
"players": ["1", "2"]
}
}
接收JSON对象的C#WebMetod
[WebMethod]
public static void SaveTeam(Object user)
{
}
类,表示传递给WebMethod的JSON对象的对象 struct
public class User
{
public string name { get; set; }
public string teamname { get; set; }
public string email { get; set; }
public Array players { get; set; }
}