【发布时间】:2016-04-19 18:05:06
【问题描述】:
我正在尝试通过使用动态类型来反序列化在其某些属性名称中包含破折号 (-) 字符的 JSON:
string json = MyWebClient.DownloadString("http://api.crossref.org/works/10.1093/brain/75.2.187");
dynamic result = JsonConvert.DeserializeObject<dynamic>(json);
string title = result.message.title[0];
string journal = result.message.container-title[0];
由于使用了非法字符,我无法获取“container-title”值。而且我不想简单地使用Replace() 来删除破折号。有什么办法吗?
【问题讨论】: