【发布时间】:2019-02-01 10:42:57
【问题描述】:
我被这个问题困扰了很长时间,所以我在这里问。
我收到以下错误消息:
"Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'XXX' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly."
这就是我的班级的样子:
public class SSN
{
public IDictionary<string,string> ssns { get; set; }
}
这是 json 格式:
【问题讨论】:
-
您如何称呼 Newtonsoft?添加这些行
-
先尝试创建并序列化对象,看看json文件应该是什么样子,然后你就明白了! :)