我有这样一个JSON字符串:
'{"1":[1,3,5],"2":[2,5,6],"3":[5,6,8]}'
我想通过Web Api控制器发送它,而不使用ajax请求更改它:
$.ajax({
type: "POST",
url: "Api/Serialize/Dict",
data: JSON.stringify(sendedData),
dataType: "json"
});
在 Web Api 中我有这样一个方法:
[HttpPost]
public object Dict(Dictionary<int, List<int>> sendedData)
{
//code goes here
return null;
}
我总是得到 sendedData == null.
的结果。换句话说:我不知道如何将 JSON 反序列化为 (Dictionary<int, List<int>>
。
谢谢你的回答。