当尝试在我的类中反序列化此属性时,我得到以下错误消息:-
读取字符串错误。意想不到的标记:StartArray。路径的['开立账户,以下哪一项适用?']',第53行,第58位。
JSON片段
"When opening the account which of these applied?": [
"option1",
"option2",
"option3",
"option4"
]
c#属性:-
[JsonProperty(PropertyName = "When opening the account which of these applied?")]
public string Whenopeningtheaccountwhichoftheseapplied { get; set; }
是唯一会抛出错误的属性。
我使用以下语句反序列化:——
var submission = JsonConvert.DeserializeObject<FormStackSubmission>(json);
关于它为什么这样做有什么想法吗?
它不是一个单独的项目,而是一个数组。如果你像下面这样更新你的类,它应该可以工作了:
[JsonProperty(PropertyName = "When opening the account which of these applied?")]
public List<string> Whenopeningtheaccountwhichoftheseapplied { get; set; }