asp.net mvc post 接受 传输过来的json数据 并序列化为dynamic 方便访问 一句代码
[HttpPost]
public ActionResult Login()
{
var form = JsonConvert.DeserializeObject<dynamic>(new StreamReader(Request.InputStream).ReadToEnd());
string username = form.username;
string password = form.password;
....
}
x
1
[HttpPost]
2
public ActionResult Login()
3
{
4
var form = JsonConvert.DeserializeObject<dynamic>(new StreamReader(Request.InputStream).ReadToEnd());
5
string username = form.username;
6
string password = form.password;
7
....
8
}