在控制台应用程序中,我运行代码:
string json = "{\"id\": \"5\"}";
dynamic result = JObject.Parse(json);
var id = result.id;
结果:
id = 5;
在使用此代码的 Windows Phone 8 中,我有异常(exception):
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
我有 Newtonsoft.Json
版本 5.0.8。
可能是什么问题?
最佳答案
我认为你必须找到你的数据,因为结果是 JObject
所以
var id = result["id"];
关于c# - Windows Phone 8 中的 JObject.Parse 动态类型问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20368793/