Reputation: 81
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"
}
]
.......
I have 2 classes:
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; }
}
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".
What is wrong?
Peter
Upvotes: 0
Views: 535