RuntimeBinderException与Newtonsoft.Json解析JSON时 [英] RuntimeBinderException when parsing json with Newtonsoft.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屋!