.net - 使用 Newtonsoft.Json 解析 json 时出现 RuntimeBinderException

标签 .net json windows-phone json.net

我正在尝试将简单的 json 解析为 Windows Phone 8 中的动态对象。我将 Newtonsoft.JSON 库与此代码一起使用:

dynamic response = JObject.Parse(responseText);
string streamRequestUrl = response._links.streams;

我可以知道 _links 在那里 enter image description here 但是当我尝试阅读它时,我得到了 Microsoft.CSharp.RuntimeBinder.RuntimeBinderException。如何从中获取 _links 属性值?

最佳答案

我在 VS 2015 中遇到了类似的问题。使用 [] 访问属性的方法有效,但是如果我在工具 > 选项 > 调试 > 常规中启用“仅我的代码”。我能够像往常一样使用动态对象的属性,例如代码如:response._links.streams; 有效。

请参阅另一篇带有 similar question 的帖子

关于.net - 使用 Newtonsoft.Json 解析 json 时出现 RuntimeBinderException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15706327/

相关文章:

.net - 在 Visual Studio 2012 中自定义 UMLClassDiagram

基于接口(interface)设计的C#泛型方法

android - 是否可以使用相同模型使用 JSONObject 和 RealmObject 进行解析?

.net - 信任位于网络共享上的程序集

c# - 默认文件名 SaveFileDialog

python - 使用 dropbox API 下载指定文件夹中的所有图像,而不是子文件夹

java - 格式化 java 在 JSON 中注销以在 ELK Stack 中使用

xaml - 将 ContentDialog 设置为在 UWP 页面底部显示

windows-runtime - 在 Windows Phone RT 应用程序中调用 RenderAsync() 时出现 System.ArguementException

silverlight - 如何在 Windows Phone 7 键盘中仅显示数字键?