public static CheckinResponse ParseJson(JToken json) { var r = new CheckinResponse(); var tt = new TombstoningText("response"); tt.Text = json.ToString(); tt.Save(r.UniqueId); try { var checkin = json["checkin"]; // (JArray)json["checkin"]; // string type = Json.TryGetJsonProperty(checkin, "type"); // checkin,shout,venueless string created = Json.TryGetJsonProperty(checkin, "createdAt"); if (created != null) { DateTime dtc = UnixDate.ToDateTime(created); r.Created = dtc; } r.CheckinId = Json.TryGetJsonProperty(checkin, "id"); var venue = checkin["venue"]; if (venue != null) { r.Venue = CompactVenue.ParseJson(venue); } return(r); } catch (Exception e) { throw new UserIntendedException( "There was a problem trying to check-in, please try again later.", e); } }
public static CheckinResponse ParseJson(JToken json) { var r = new CheckinResponse(); var tt = new TombstoningText("response"); tt.Text = json.ToString(); tt.Save(r.UniqueId); try { var checkin = json["checkin"]; // (JArray)json["checkin"]; // string type = Json.TryGetJsonProperty(checkin, "type"); // checkin,shout,venueless string created = Json.TryGetJsonProperty(checkin, "createdAt"); if (created != null) { DateTime dtc = UnixDate.ToDateTime(created); r.Created = dtc; } r.CheckinId = Json.TryGetJsonProperty(checkin, "id"); var venue = checkin["venue"]; if (venue != null) { r.Venue = CompactVenue.ParseJson(venue); } return r; } catch (Exception e) { throw new UserIntendedException( "There was a problem trying to check-in, please try again later.", e); } }