我之前问过这个问题,现在我遇到了另一个类似的 JSON 字符串的问题。
这是我的 JSON 字符串:
{"responseObject":{"code":"0","message":"HI","url":"www.abc.com","token":"{\"token\":\"abcdef\",\"id\":123}"}}
这是我的 dserialize 代码,它不起作用:
var def = new
{
code = string.Empty,
message = string.Empty,
url= string.Empty,
token = new {token = string.Empty}
};
var response = JsonConvert.DeserializeAnonymousType(data, def);
var innerDef = new { token= string.Empty, id= string.Empty };
var deserializedInner = JsonConvert.DeserializeAnonymousType(response.token.token, innerDef);