我有这样的 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>>
.
谢谢你的答案。