public DeserializeJson ( JToken inputObject ) : void | ||
inputObject | JToken | |
return | void |
public virtual void DeserializeJson(JToken inputObject)
{
if (inputObject != null && inputObject.Type != JTokenType.Null)
{
JToken contentTypeValue = inputObject["contentType"];
if (contentTypeValue != null && contentTypeValue.Type != JTokenType.Null)
{
this.ContentType = ((string)contentTypeValue);
}
JToken urlValue = inputObject["url"];
if (urlValue != null && urlValue.Type != JTokenType.Null)
{
this.Url = ((string)urlValue);
}
}
}
/// <summary> /// Deserialize the object /// </summary> public virtual void DeserializeJson(JToken inputObject) { if (inputObject != null && inputObject.Type != JTokenType.Null) { JToken attachmentsSequence = ((JToken)inputObject["attachments"]); if (attachmentsSequence != null && attachmentsSequence.Type != JTokenType.Null) { foreach (JToken attachmentsValue in ((JArray)attachmentsSequence)) { Attachment attachment = new Attachment(); attachment.DeserializeJson(attachmentsValue); this.Attachments.Add(attachment); } } JToken channelDataValue = inputObject["channelData"]; if (channelDataValue != null && channelDataValue.Type != JTokenType.Null) { this.ChannelData = channelDataValue.ToString(Newtonsoft.Json.Formatting.Indented); } JToken conversationIdValue = inputObject["conversationId"]; if (conversationIdValue != null && conversationIdValue.Type != JTokenType.Null) { this.ConversationId = ((string)conversationIdValue); } JToken createdValue = inputObject["created"]; if (createdValue != null && createdValue.Type != JTokenType.Null) { this.Created = ((DateTimeOffset)createdValue); } JToken eTagValue = inputObject["eTag"]; if (eTagValue != null && eTagValue.Type != JTokenType.Null) { this.ETag = ((string)eTagValue); } JToken fromValue = inputObject["from"]; if (fromValue != null && fromValue.Type != JTokenType.Null) { this.From = ((string)fromValue); } JToken idValue = inputObject["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { this.Id = ((string)idValue); } JToken imagesSequence = ((JToken)inputObject["images"]); if (imagesSequence != null && imagesSequence.Type != JTokenType.Null) { foreach (JToken imagesValue in ((JArray)imagesSequence)) { this.Images.Add(((string)imagesValue)); } } JToken textValue = inputObject["text"]; if (textValue != null && textValue.Type != JTokenType.Null) { this.Text = ((string)textValue); } } }