如何从json格式中获取列表

本文关键字:获取 列表 格式 json | 更新日期: 2023-09-27 17:49:41

我需要从json格式获取列表模型。

I have action:

[HttpPost]
public ActionResult SaveKo(List<UserViewModel> model)
{
    return View();
}

我发送json数组:

ko.utils.postJson('@Url.Action("SaveKo", "User")', { model: self.users });

格式标题:

Request URL:http://localhost:10001/user/SaveKO
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:windows-1251,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:4576
Content-Type:application/x-www-form-urlencoded
Cookie:ASP.NET_SessionId=abu54mtmtjq0h2551vt0o2ug; .fairzeit=7E91AC1F2A977E037118C7F1564F45B8B89E74C897FC919811C29652C6123F23B2C979CD4B51F1BC4C271C93E95A81E807D00E5B47AFCD87ECAE1BA5245F73474B5AB610E19A10CB16C050D6899D23AC15E3530E1D85997B553F07681F5304DA837DFA5766F3AC9BF0CBFC2B31436E708BFA95EC5AEA58FEFB717DDE350DBC57665AA230D5615DE9AFEB1021C3A45B98C726598CF2E9E8E90FEC1C488B3C8DAC
Host:localhost:10001
Origin:http://localhost:10001
Referer:http://localhost:10001/user/indexko
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
Form Dataview URL encoded
0:{"PersonalNummer":"1","Name":"Admin","Vorname":"Admin","Login":"none","EMail":"admin@q.de"}
1:{"PersonalNummer":"2","Name":"Test","Vorname":"Test","Login":"test_disponent","EMail":"test_disponent@q.de"}
2:{"PersonalNummer":"3","Name":"Bennemann","Vorname":"Christian","Login":"cbenn","EMail":"c.bennemann@q.de"}

如何从json格式中获取列表

ko.utils.postJson('@Url.Action("SaveKo", "User")', self.users);