RuntimeBinderException与Newtonsoft.Json解析JSON时 [英] RuntimeBinderException when parsing json with Newtonsoft.Json

查看:600
本文介绍了RuntimeBinderException与Newtonsoft.Json解析JSON时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解析简单的JSON动态物体的Windows phone 8我使用Newtonsoft.JSON库与此code:

I'm trying to parse simple json to dynamic object in Windows phone 8. I'm using Newtonsoft.JSON library with this code:

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

我可以在_links是present有 但是,当我试着读它,我得到 Microsoft.CSharp.RuntimeBinder.RuntimeBinderException 。如何获得_links属性值的出来吗?

I can that _links are present there But when I try to read it I get Microsoft.CSharp.RuntimeBinder.RuntimeBinderException. How to get _links property value out of it?

推荐答案

我打在VS 2015使用[]进入属性的工作方式方法类似,但是如果我能够在仅我的code工具>选项>调试>常规。我能够在动态对象为正常,例如使用属性code,如: response._links.streams; 工作

I was hitting something similar in VS 2015. The approach using [] to access the properties works, however if I enable "Just My Code" in Tools > Options > Debugging > General. I was able to use the properties on the dynamic objects as normal e.g. code like: response._links.streams; worked.

请参阅本等后用<一个href="http://stackoverflow.com/questions/20487305/runtimebinderexception-while-using-newtonsoft-json-with-dynamic-after-installing/33429521#33429521">similar问题

这篇关于RuntimeBinderException与Newtonsoft.Json解析JSON时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆