在Mix10 演示期间,演示者 (Charlie Kindel) 说,在为 WP7 编写基于 Silverlight 的应用程序时,您将获得所有 Silverlight 3.0 和一些 Silverlight 4.0 混合。
那么为什么 System.Json 不见了?它包含在 Silverlight 3.0 中,并包含在 Silverlight 4.0 中。
在Mix10 演示期间,演示者 (Charlie Kindel) 说,在为 WP7 编写基于 Silverlight 的应用程序时,您将获得所有 Silverlight 3.0 和一些 Silverlight 4.0 混合。
那么为什么 System.Json 不见了?它包含在 Silverlight 3.0 中,并包含在 Silverlight 4.0 中。
添加对的引用System.ServiceModel.Web
以及对的引用System.Runtime.Serialization
,它应该可以工作。 System.ServiceModel.Web
似乎添加.JSON
到Serialization
命名空间。
您也可以尝试使用 MIX RC 工具http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx中肯定存在的 DataContractJsonSerializer 。
Seems that JSON is supported in Windows Phone 7 in the System.Runtime.Serialization.Json namespace, hopefully this will be useful, even though this question is a month old! Information from the TechDays in London (via Twitter) was not there personally.
Just an update is that the namespace and class I quoted here was incorrect so here is the correct namespace and class:
System.Servicemodel.Web and the Class is DataContractJsonSerializer for JSON Serialisation and Deserialisation on Windows Phone 7 - sorry about the inaccurate reply I have corrected after a comment posted here.
在我们的 Windows Phone 7 项目中,我们使用的是James Newton-Kings JSON.Net Library。只需下载代码并添加对Newtonsoft.Json.Silverlight的引用。奇迹般有效。
我不能告诉你为什么 JSON 命名空间不在那里,但也许你可以使用支持 JSON 的 Windows Phone 7 的 OData 客户端库:
我也不知道为什么,但它在这个链接上说不支持命名空间