Note that there are some explanatory texts on larger screens.

plurals
  1. PODeserialize LiveSDK calendar with JSon.Net
    primarykey
    data
    text
    <p>I am new to JSon, especially JSon.Net. I am trying to use the LiveSDK on Windows Phone and i am having an issue parsing out the JSon response. I am trying to read calendar information and I can't get it to parse. Below is my code for downloading the Json and my class definition. I get an exception on the line defining 'user'.</p> <pre><code> void getCal_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e) { if (e.Error == null) { using (var reader = new StreamReader(e.Result)) { var json = reader.ReadToEnd(); var user = JsonConvert.DeserializeObject&lt;Calendar&gt;(json); } } } </code></pre> <p>My Calendar class</p> <pre><code> [JsonObject(MemberSerialization.OptIn)] public class Calendar { [JsonProperty(PropertyName="name")] public string Name{get; set;} [JsonProperty(PropertyName = "id")] public string Id{get; set;} [JsonProperty(PropertyName = "description")] public string Description{get; set;} [JsonProperty(PropertyName = "created_time")] public string CreatedTime{get; set;} [JsonProperty(PropertyName = "updated_time")] public string UpdatedTime{get; set;} [JsonProperty(PropertyName = "from")] public object From{get; set;} [JsonProperty(PropertyName = "is_default")] public bool IsDefault{get; set;} [JsonProperty(PropertyName = "subscription_location")] public string SubscriptionLocation{get; set;} [JsonProperty(PropertyName = "permissions")] public string Permissions{get; set;} } </code></pre> <p>The JSon Format received</p> <pre><code> { "data": [ { "id": "calendar.42d4dbc866f94c83849c88c6eb9985bc", "name": "Birthday calendar", "description": "If you have birthdays listed for your contacts, they'll appear on this calendar. You can add more birthdays, but you can't add other types of events.", "created_time": "2011-08-05T19:41:04+0000", "updated_time": "2011-08-05T19:41:04+0000", "from": { "name": null, "id": null }, "is_default": false, "subscription_location": null, "permissions": "read" },{ ... } </code></pre> <p>] }</p> <p>I was no having luck using the LiveSDK GetAsync() so i went with DownloadAsync() instead. Is this approach better?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload