反序列化,JSON,WP7 [英] Deserialize, JSON, WP7
本文介绍了反序列化,JSON,WP7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试反序列化此Json:
I am trying to deserialize this Json:
[
{
"Address": "String content",
"CategoryId": 2147483647,
"CategoryName": "String content",
"City": "String content",
"Email": "String content",
"GroupComment": "String content",
"GroupName": "String content",
"IntegrationType": "String content",
"Location": {
"Latitude": 1267432330000000,
"Longitude": 1267432330000000
},
"Phone": "String content",
"StoreComment": "String content",
"StoreName": "String content",
"Website": "String content",
"ZipCode": "String content"
}
]
.......
我有2个课程:
public class Stores
{
public string Address { get; set; }
.......
public GeoLocation geoLocation { get; set; }
}
public class GeoLocation
{
public double Latitude { get; set; }
public double Longitude { get; set; }
}
我像这样反序列化Json:
And I am deserialize the Json like this:
Stores[] st = new Stores[200];
MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(e.Result));
DataContractJsonSerializer serializer = new DataContractJsonSerializer(st.GetType());
st = serializer.ReadObject(ms) as Stores[];
ms.Close();
我得到了地址等信息,但是地理位置无法计算表达式".
I get the Address etc, but the GeoLocation "Could not evaluate expression".
怎么了?
彼得
推荐答案
尝试将geoLocation成员名称更改为Location吗?
Try changing the geoLocation member name to Location?
这篇关于反序列化,JSON,WP7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文