【发布时间】:2017-01-19 09:25:47
【问题描述】:
我正在使用 Newtonsoft.Json 反序列化我的 json。这是我的 json 字符串。
{
"data": {
"type": "records",
"id": "7",
"attributes": {
"created": "2017-01-19T08:42:56Z",
"updated": "2017-01-19T08:42:56Z",
"state": 3,
"data": {
"Lastname": [
"Gonzales"
],
"Firstname": [
"Lacy"
],
"Email": [
"ludam@gmail.com"
],
"Salutation": [
"Mrs."
]
}
}
}
}
所以当我创建一个像这样的动态变量并将名字分配给字符串 s 时,我得到了一个 RuntimebinderException。
dynamic data = JsonConvert.DeserializeObject(responseString2);
string s = data.attributes.data.Firstname;
有什么我忘记了吗?感谢您的帮助
【问题讨论】:
标签: c# json json.net json-deserialization