【发布时间】:2015-01-15 17:30:59
【问题描述】:
我在 ASP.NET WEB API 应用程序中有一个端点,如下所示:
[HttpPost]
public dynamic Save(string userId, List<MyObject> data)
{
return null;
}
public class MyObject
{
public string name { get; set; }
public List<itemAttribute> items { get; set; }
}
public class itemAttribute
{
public int id { get; set; }
public string typeName { get; set; }
public string fullName { get; set; }
public bool Checked { get; set; }
}
我正在尝试发布以下 JavaScript 对象
data = [
{
"name": "One",
"items": [
{
"fullName": "name",
"Checked": true,
"typeName": "type 1",
"id": 1
},
{
"fullName": "nametwo",
"Checked": true,
"typeName": "some type 2",
"id": 2
}
]
}
]
当我到达终点时,data 将作为一个空列表出现。我没有看到任何具体的错误。请帮忙。
现在我正在使用火狐的 REST 客户端发布数据
【问题讨论】:
-
很高兴接受一个答案(如果有帮助的话):)
标签: javascript asp.net .net asp.net-mvc-3 asp.net-web-api2