我如何使用的JSONObject类? [英] How can I use the JsonObject class?

查看:211
本文介绍了我如何使用的JSONObject类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立在Windows Phone 7。我注意到在文档中,我可以:

I am building on Windows Phone 7. I noticed in the documentation I can:

JsonObject user = (JsonObject)JsonObject.Load(responseStream);
bool isMember = user["IsMember"];
string name = user["Name"];
int age = user["Age"];

我怎么能导入的JSONObject类?

How can I import the JsonObject class?

推荐答案

添加使用System.Json; 到文件的顶部

修改
看来,Windows Phone 7的不支持 System.Json 命名空间,所以你不能做这种方式。粗略搜索后,看来你必须使用 DataContractJsonSerializer 类,如中的这个的MSDN视频/源$ C ​​$ C。

Edit
It seems that Windows Phone 7 doesn't support the System.Json namespace so you cannot do it this way. After a cursory search, it seems you have to use the DataContractJsonSerializer class as shown in this MSDN video/source code.

您可能还需要考虑使用 Json.NET 这似乎是很多比更有效在 DataContractJsonSerializer

You may also want to consider using Json.NET which appears to be much more efficient than the DataContractJsonSerializer.

这篇关于我如何使用的JSONObject类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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