public object Deserialize(JsonValue json, JsonMapper mapper) { Photo photo = null; if ( json != null && !json.IsNull ) { photo = new Photo(); photo.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; photo.Name = json.ContainsName("name" ) ? json.GetValue<string>("name" ) : String.Empty; photo.Icon = json.ContainsName("icon" ) ? json.GetValue<string>("icon" ) : String.Empty; photo.Picture = json.ContainsName("picture" ) ? json.GetValue<string>("picture" ) : String.Empty; photo.Source = json.ContainsName("source" ) ? json.GetValue<string>("source" ) : String.Empty; photo.Height = json.ContainsName("height" ) ? json.GetValue<int >("height" ) : 0; photo.Width = json.ContainsName("width" ) ? json.GetValue<int >("width" ) : 0; photo.Link = json.ContainsName("link" ) ? json.GetValue<string>("link" ) : String.Empty; photo.Position = json.ContainsName("position" ) ? json.GetValue<int >("position") : 0; photo.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; photo.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; photo.From = mapper.Deserialize<Reference>(json.GetValue("from" )); photo.Place = mapper.Deserialize<Page >(json.GetValue("place")); photo.Tags = mapper.Deserialize<List<Tag>>(json.GetValue("tags" )); photo.Images = mapper.Deserialize<List<Photo.Image>>(json.GetValue("images")); if ( photo.Images != null ) { int i = 0; if ( photo.Images.Count >= 5 ) photo.OversizedImage = photo.Images[i++]; if ( photo.Images.Count >= 1 ) photo.SourceImage = photo.Images[i++]; if ( photo.Images.Count >= 2 ) photo.AlbumImage = photo.Images[i++]; if ( photo.Images.Count >= 3 ) photo.SmallImage = photo.Images[i++]; if ( photo.Images.Count >= 4 ) photo.TinyImage = photo.Images[i++]; } } return photo; }
public object Deserialize(JsonValue json, JsonMapper mapper) { Comment comment = null; if (json != null && !json.IsNull) { comment = new Comment(); comment.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; comment.Message = json.ContainsName("message") ? json.GetValue <string>("message") : String.Empty; comment.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; comment.From = mapper.Deserialize <Reference>(json.GetValue("from")); // 04/12/2012 Paul. Likes is a connection object, so make sure that this is not the same likes property value. // 04/15/2012 Paul. Likes can be a number or an array. JsonValue jsonLikes = json.GetValue("likes"); if (jsonLikes != null && !jsonLikes.IsNull) { if (jsonLikes.IsArray) { comment.Likes = mapper.Deserialize <List <Reference> >(jsonLikes); comment.LikesCount = (comment.Likes != null) ? comment.Likes.Count : 0; } else if (jsonLikes.IsNumber) { comment.LikesCount = jsonLikes.GetValue <int>(); } } } return(comment); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Comment comment = null; if ( json != null && !json.IsNull ) { comment = new Comment(); comment.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; comment.Message = json.ContainsName("message" ) ? json.GetValue<string>("message") : String.Empty; comment.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; comment.From = mapper.Deserialize<Reference >(json.GetValue("from" )); // 04/12/2012 Paul. Likes is a connection object, so make sure that this is not the same likes property value. // 04/15/2012 Paul. Likes can be a number or an array. JsonValue jsonLikes = json.GetValue("likes"); if ( jsonLikes != null && !jsonLikes.IsNull ) { if ( jsonLikes.IsArray ) { comment.Likes = mapper.Deserialize<List<Reference>>(jsonLikes); comment.LikesCount = (comment.Likes != null) ? comment.Likes.Count : 0; } else if ( jsonLikes.IsNumber ) { comment.LikesCount = jsonLikes.GetValue<int>(); } } } return comment; }
public object Deserialize(JsonValue value, JsonMapper mapper) { Tweet tweet = new Tweet(); tweet.ID = value.GetValue <long>("id"); tweet.Text = value.GetValue <string>("text"); tweet.CreatedAt = JsonUtils.ToDateTime(value.GetValueOrDefault <string>("created_at"), TWEET_DATE_FORMAT); JsonValue userValue = value.GetValue("user"); if (userValue != null && userValue.IsObject) { tweet.User = mapper.Deserialize <TwitterProfile>(userValue); tweet.FromUser = tweet.User.ScreenName; tweet.FromUserId = tweet.User.ID; tweet.ProfileImageUrl = tweet.User.ProfileImageUrl; } tweet.ToUserId = value.GetValueOrDefault <long?>("in_reply_to_user_id"); tweet.InReplyToUserId = value.GetValueOrDefault <long?>("in_reply_to_user_id"); tweet.InReplyToUserScreenName = value.GetValueOrDefault <string>("in_reply_to_screen_name"); tweet.InReplyToStatusId = value.GetValueOrDefault <long?>("in_reply_to_status_id"); tweet.Source = value.GetValueOrDefault <string>("source"); JsonValue placeValue = value.GetValue("place"); if (placeValue != null && placeValue.IsObject) { tweet.Place = mapper.Deserialize <Place>(placeValue); } tweet.LanguageCode = value.GetValueOrDefault <string>("iso_language_code"); tweet.FavoriteCount = value.GetValueOrDefault <int>("favorite_count"); tweet.RetweetCount = value.GetValueOrDefault <int>("retweet_count"); JsonValue retweetedStatusValue = value.GetValue("retweeted_status"); if (retweetedStatusValue != null && retweetedStatusValue.IsObject) { tweet.RetweetedStatus = mapper.Deserialize <Tweet>(retweetedStatusValue); } tweet.IsRetweetedByUser = value.GetValueOrDefault <bool>("retweeted"); tweet.IsFavoritedByUser = value.GetValueOrDefault <bool>("favorited"); JsonValue retweetIdValue = value.GetValue("current_user_retweet"); if (retweetIdValue != null && retweetIdValue.IsObject) { tweet.RetweetIdByUser = retweetIdValue.GetValue <long?>("id"); } // Entities JsonValue entitiesValue = value.GetValue("entities"); if (entitiesValue != null) { tweet.Entities = new TweetEntities(); tweet.Entities.Hashtags = DeserializeHashtags(entitiesValue.GetValue("hashtags")); tweet.Entities.UserMentions = DeserializeUserMentions(entitiesValue.GetValue("user_mentions")); tweet.Entities.Urls = DeserializeUrls(entitiesValue.GetValue("urls")); tweet.Entities.Media = DeserializeMedia(entitiesValue.GetValue("media")); } return(tweet); }
public object Deserialize(JsonValue json, JsonMapper mapper) { return new DirectMessage() { ID = json.GetValue<long>("id"), Text = json.GetValue<string>("text"), Sender = mapper.Deserialize<TwitterProfile>(json.GetValue("sender")), Recipient = mapper.Deserialize<TwitterProfile>(json.GetValue("recipient")), CreatedAt = JsonUtils.ToDateTime(json.GetValue<string>("created_at"), DIRECT_MESSAGE_DATE_FORMAT) }; }
public object Deserialize(JsonValue json, JsonMapper mapper) { return(new DirectMessage() { ID = json.GetValue <long>("id"), Text = json.GetValue <string>("text"), Sender = mapper.Deserialize <TwitterProfile>(json.GetValue("sender")), Recipient = mapper.Deserialize <TwitterProfile>(json.GetValue("recipient")), CreatedAt = JsonUtils.ToDateTime(json.GetValue <string>("created_at"), DIRECT_MESSAGE_DATE_FORMAT) }); }
public object Deserialize(JsonValue value, JsonMapper mapper) { Tweet tweet = new Tweet(); tweet.ID = value.GetValue<long>("id"); tweet.Text = value.GetValue<string>("text"); tweet.CreatedAt = JsonUtils.ToDateTime(value.GetValueOrDefault<string>("created_at"), TWEET_DATE_FORMAT); JsonValue userValue = value.GetValue("user"); if (userValue != null && userValue.IsObject) { tweet.User = mapper.Deserialize<TwitterProfile>(userValue); tweet.FromUser = tweet.User.ScreenName; tweet.FromUserId = tweet.User.ID; tweet.ProfileImageUrl = tweet.User.ProfileImageUrl; } tweet.ToUserId = value.GetValueOrDefault<long?>("in_reply_to_user_id"); tweet.InReplyToUserId = value.GetValueOrDefault<long?>("in_reply_to_user_id"); tweet.InReplyToUserScreenName = value.GetValueOrDefault<string>("in_reply_to_screen_name"); tweet.InReplyToStatusId = value.GetValueOrDefault<long?>("in_reply_to_status_id"); tweet.Source = value.GetValueOrDefault<string>("source"); JsonValue placeValue = value.GetValue("place"); if (placeValue != null && placeValue.IsObject) { tweet.Place = mapper.Deserialize<Place>(placeValue); } tweet.LanguageCode = value.GetValueOrDefault<string>("iso_language_code"); tweet.RetweetCount = value.GetValueOrDefault<int>("retweet_count"); JsonValue retweetedStatusValue = value.GetValue("retweeted_status"); if (retweetedStatusValue != null && retweetedStatusValue.IsObject) { tweet.RetweetedStatus = mapper.Deserialize<Tweet>(retweetedStatusValue); } tweet.IsRetweetedByUser = value.GetValueOrDefault<bool>("retweeted"); tweet.IsFavoritedByUser = value.GetValueOrDefault<bool>("favorited"); JsonValue retweetIdValue = value.GetValue("current_user_retweet"); if (retweetIdValue != null && retweetIdValue.IsObject) { tweet.RetweetIdByUser = retweetIdValue.GetValue<long?>("id"); } // Entities JsonValue entitiesValue = value.GetValue("entities"); if (entitiesValue != null) { tweet.Entities = new TweetEntities(); tweet.Entities.Hashtags = DeserializeHashtags(entitiesValue.GetValue("hashtags")); tweet.Entities.UserMentions = DeserializeUserMentions(entitiesValue.GetValue("user_mentions")); tweet.Entities.Urls = DeserializeUrls(entitiesValue.GetValue("urls")); tweet.Entities.Media = DeserializeMedia(entitiesValue.GetValue("media")); } return tweet; }
public object Deserialize(JsonValue json, JsonMapper mapper) { Photo photo = null; if (json != null && !json.IsNull) { photo = new Photo(); photo.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; photo.Name = json.ContainsName("name") ? json.GetValue <string>("name") : String.Empty; photo.Icon = json.ContainsName("icon") ? json.GetValue <string>("icon") : String.Empty; photo.Picture = json.ContainsName("picture") ? json.GetValue <string>("picture") : String.Empty; photo.Source = json.ContainsName("source") ? json.GetValue <string>("source") : String.Empty; photo.Height = json.ContainsName("height") ? json.GetValue <int>("height") : 0; photo.Width = json.ContainsName("width") ? json.GetValue <int>("width") : 0; photo.Link = json.ContainsName("link") ? json.GetValue <string>("link") : String.Empty; photo.Position = json.ContainsName("position") ? json.GetValue <int>("position") : 0; photo.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; photo.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue <string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; photo.From = mapper.Deserialize <Reference>(json.GetValue("from")); photo.Place = mapper.Deserialize <Page>(json.GetValue("place")); photo.Tags = mapper.Deserialize <List <Tag> >(json.GetValue("tags")); photo.Images = mapper.Deserialize <List <Photo.Image> >(json.GetValue("images")); if (photo.Images != null) { int i = 0; if (photo.Images.Count >= 5) { photo.OversizedImage = photo.Images[i++]; } if (photo.Images.Count >= 1) { photo.SourceImage = photo.Images[i++]; } if (photo.Images.Count >= 2) { photo.AlbumImage = photo.Images[i++]; } if (photo.Images.Count >= 3) { photo.SmallImage = photo.Images[i++]; } if (photo.Images.Count >= 4) { photo.TinyImage = photo.Images[i++]; } } } return(photo); }
public object Deserialize(JsonValue json, JsonMapper mapper) { EducationEntry entry = null; if ( json != null && !json.IsNull ) { entry = new EducationEntry(); entry.Type = json.ContainsName("type" ) ? json.GetValue<string>("type") : String.Empty; entry.School = mapper.Deserialize<Reference >(json.GetValue("school" )); entry.Year = mapper.Deserialize<Reference >(json.GetValue("year" )); entry.Concentration = mapper.Deserialize<List<Reference>>(json.GetValue("concentration")); } return entry; }
public object Deserialize(JsonValue json, JsonMapper mapper) { EducationEntry entry = null; if (json != null && !json.IsNull) { entry = new EducationEntry(); entry.Type = json.ContainsName("type") ? json.GetValue <string>("type") : String.Empty; entry.School = mapper.Deserialize <Reference>(json.GetValue("school")); entry.Year = mapper.Deserialize <Reference>(json.GetValue("year")); entry.Concentration = mapper.Deserialize <List <Reference> >(json.GetValue("concentration")); } return(entry); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Question question = null; if ( json != null && !json.IsNull ) { question = new Question(); question.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; question.Text = json.ContainsName("question" ) ? json.GetValue<string>("question") : String.Empty; question.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; question.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; question.From = mapper.Deserialize<Reference >(json.GetValue("from" )); question.Options = mapper.Deserialize<List<QuestionOption>>(json.GetValue("options")); } return question; }
public override object Deserialize(JsonValue json, JsonMapper mapper) { JsonValue peopleJson = json.ContainsName("people") ? json.GetValue("people") : json; LinkedInProfiles profiles = (LinkedInProfiles)base.Deserialize(peopleJson, mapper); profiles.Profiles = mapper.Deserialize<IList<LinkedInProfile>>(peopleJson); return profiles; }
public object Deserialize(JsonValue json, JsonMapper mapper) { SimilarPlaces similarPlaces = new SimilarPlaces(mapper.Deserialize<IList<Place>>(json)); similarPlaces.PlacePrototype = new PlacePrototype(); similarPlaces.PlacePrototype.CreateToken = json.GetValue("result").GetValue<string>("token"); return similarPlaces; }
public object Deserialize(JsonValue json, JsonMapper mapper) { QuestionOption option = null; if ( json != null && !json.IsNull ) { option = new QuestionOption(); option.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; option.Name = json.ContainsName("name" ) ? json.GetValue<string>("name" ) : String.Empty; option.Votes = json.ContainsName("votes" ) ? json.GetValue<int >("votes") : 0; option.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; option.From = mapper.Deserialize<Reference>(json.GetValue("from" )); option.Object = mapper.Deserialize<Page >(json.GetValue("object")); } return option; }
public virtual object Deserialize(JsonValue json, JsonMapper mapper) { var post = CreatePost(); post.ID = json.GetValue<string>("id"); post.Creator = mapper.Deserialize<LinkedInProfile>(json.GetValue("creator")); post.Title = json.GetValueOrDefault<string>("title", String.Empty); post.Type = DeserializePostType(json.GetValue("type")); //TODO post.Attachment = DeserializeAttachment(json.GetValue("attachment")); post.CreationTimestamp = DeserializeTimeStamp.Deserialize(json.GetValue("creationTimestamp")); post.Likes = mapper.Deserialize<IList<LinkedInProfile>>(json.GetValue("likes")); //TODO RelationToViewer = DeserializePostRelation(json.GetValue("relation-to-viewer")); post.Summary = json.GetValueOrDefault<string>("summary", String.Empty); return post; }
public object Deserialize(JsonValue value, JsonMapper mapper) { DeltaPage deltaPage = new DeltaPage(); deltaPage.Cursor = value.GetValue <string>("cursor"); deltaPage.HasMore = value.GetValue <bool>("has_more"); deltaPage.Reset = value.GetValue <bool>("reset"); deltaPage.Entries = new List <DeltaEntry>(); JsonValue entriesValue = value.GetValue("entries"); if (entriesValue != null) { foreach (JsonValue entryValue in entriesValue.GetValues()) { DeltaEntry deltaEntry = new DeltaEntry(); deltaEntry.Path = entryValue.GetValue <string>(0); JsonValue metadataValue = entryValue.GetValue(1) as JsonObject; if (metadataValue != null) { deltaEntry.Metadata = mapper.Deserialize <Entry>(metadataValue); } deltaPage.Entries.Add(deltaEntry); } } return(deltaPage); }
public object Deserialize(JsonValue json, JsonMapper mapper) { CheckinPost post = null; if ( json != null && !json.IsNull ) { post = new CheckinPost(); post.ID = json.ContainsName("id" ) ? json.GetValue<string>("id") : String.Empty; post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.From = mapper.Deserialize<Reference>(json.GetValue("from" )); post.Place = mapper.Deserialize<Page >(json.GetValue("place")); post.Tags = mapper.Deserialize<List<Tag>>(json.GetValue("tags" )); } return post; }
public override object Deserialize(JsonValue json, JsonMapper mapper) { var groupPosts = (GroupPosts)base.Deserialize(json, mapper); groupPosts.Posts = mapper.Deserialize <IList <Post> >(json); return(groupPosts); }
public virtual object Deserialize(JsonValue json, JsonMapper mapper) { var post = CreatePost(); post.ID = json.GetValue <string>("id"); post.Creator = mapper.Deserialize <LinkedInProfile>(json.GetValue("creator")); post.Title = json.GetValueOrDefault <string>("title", String.Empty); post.Type = DeserializePostType(json.GetValue("type")); //TODO post.Attachment = DeserializeAttachment(json.GetValue("attachment")); post.CreationTimestamp = DeserializeTimeStamp.Deserialize(json.GetValue("creationTimestamp")); post.Likes = mapper.Deserialize <IList <LinkedInProfile> >(json.GetValue("likes")); //TODO RelationToViewer = DeserializePostRelation(json.GetValue("relation-to-viewer")); post.Summary = json.GetValueOrDefault <string>("summary", String.Empty); return(post); }
public void DeserializeUnknownType() { JsonMapper mapper = new JsonMapper(); mapper.RegisterDeserializer(typeof(Class1), new Class1Deserializer()); mapper.Deserialize<Class2>(new JsonValue()); }
object IJsonDeserializer.Deserialize(JsonValue json, JsonMapper mapper) { var results = new SearchResults(); var userJson = json.GetValue("auth_user"); var pagingJson = json.GetValue("paging"); var jobsJson = json.GetValue("jobs"); results.ServerTime = json.GetValueOrDefault<long>("server_time"); results.ProfileAccess = json.GetValueOrDefault<string>("profile_access"); if (userJson != null) { results.AuthUser.FirstName = userJson.GetValue<string>("first_name"); results.AuthUser.LastName = userJson.GetValue<string>("last_name"); results.AuthUser.Username = userJson.GetValue<string>("uid"); results.AuthUser.Email = userJson.GetValue<string>("mail"); results.AuthUser.TimeZone = userJson.GetValue<string>("timezone"); results.AuthUser.TimeZoneOffset = userJson.GetValue<string>("timezone_offset"); } if (pagingJson != null) { results.Paging.Count = pagingJson.GetValue<int>("count"); results.Paging.Offset = pagingJson.GetValue<int>("offset"); results.Paging.Total = pagingJson.GetValue<int>("total"); } results.Jobs = mapper.Deserialize<List<Job>>(jobsJson); return results; }
public object Deserialize(JsonValue json, JsonMapper mapper) { SimilarPlaces similarPlaces = new SimilarPlaces(mapper.Deserialize <IList <Place> >(json)); similarPlaces.PlacePrototype = new PlacePrototype(); similarPlaces.PlacePrototype.CreateToken = json.GetValue("result").GetValue <string>("token"); return(similarPlaces); }
public object Deserialize(JsonValue json, JsonMapper mapper) { QuestionOption option = null; if (json != null && !json.IsNull) { option = new QuestionOption(); option.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; option.Name = json.ContainsName("name") ? json.GetValue <string>("name") : String.Empty; option.Votes = json.ContainsName("votes") ? json.GetValue <int>("votes") : 0; option.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; option.From = mapper.Deserialize <Reference>(json.GetValue("from")); option.Object = mapper.Deserialize <Page>(json.GetValue("object")); } return(option); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Question question = null; if (json != null && !json.IsNull) { question = new Question(); question.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; question.Text = json.ContainsName("question") ? json.GetValue <string>("question") : String.Empty; question.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; question.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue <string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; question.From = mapper.Deserialize <Reference>(json.GetValue("from")); question.Options = mapper.Deserialize <List <QuestionOption> >(json.GetValue("options")); } return(question); }
public override object Deserialize(JsonValue json, JsonMapper mapper) { JsonValue peopleJson = json.ContainsName("people") ? json.GetValue("people") : json; LinkedInProfiles profiles = (LinkedInProfiles)base.Deserialize(peopleJson, mapper); profiles.Profiles = mapper.Deserialize <IList <LinkedInProfile> >(peopleJson); return(profiles); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<Entry> entries = new List<Entry>(); foreach (JsonValue itemValue in value.GetValues()) { entries.Add(mapper.Deserialize<Entry>(itemValue)); } return entries; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<Place> places = new List<Place>(); foreach (JsonValue itemValue in value.GetValue("result").GetValues("places")) { places.Add(mapper.Deserialize<Place>(itemValue)); } return places; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<SavedSearch> savedSearches = new List<SavedSearch>(); foreach (JsonValue itemValue in value.GetValues()) { savedSearches.Add(mapper.Deserialize<SavedSearch>(itemValue)); } return savedSearches; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<DirectMessage> directMessages = new List<DirectMessage>(); foreach (JsonValue itemValue in value.GetValues()) { directMessages.Add(mapper.Deserialize<DirectMessage>(itemValue)); } return directMessages; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<Tweet> tweets = new List<Tweet>(); foreach (JsonValue itemValue in value.GetValues()) { tweets.Add(mapper.Deserialize<Tweet>(itemValue)); } return tweets; }
public object Deserialize(JsonValue value, JsonMapper mapper) { return new SearchResults() { Tweets = mapper.Deserialize<IList<Tweet>>(value.GetValue("results")), MaxId = value.GetValue<long>("max_id"), SinceId = value.GetValue<long>("since_id") }; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<UserList> userLists = new List<UserList>(); foreach (JsonValue itemValue in value.GetValues()) { userLists.Add(mapper.Deserialize<UserList>(itemValue)); } return userLists; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <UserList> userLists = new List <UserList>(); foreach (JsonValue itemValue in value.GetValues()) { userLists.Add(mapper.Deserialize <UserList>(itemValue)); } return(userLists); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <DirectMessage> directMessages = new List <DirectMessage>(); foreach (JsonValue itemValue in value.GetValues()) { directMessages.Add(mapper.Deserialize <DirectMessage>(itemValue)); } return(directMessages); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList<TwitterProfile> twitterProfiles = new List<TwitterProfile>(); JsonValue usersValue = value.IsObject ? value.GetValue("users") : value; foreach (JsonValue itemValue in usersValue.GetValues()) { twitterProfiles.Add(mapper.Deserialize<TwitterProfile>(itemValue)); } return twitterProfiles; }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <SavedSearch> savedSearches = new List <SavedSearch>(); foreach (JsonValue itemValue in value.GetValues()) { savedSearches.Add(mapper.Deserialize <SavedSearch>(itemValue)); } return(savedSearches); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <Tweet> tweets = new List <Tweet>(); foreach (JsonValue itemValue in value.GetValues()) { tweets.Add(mapper.Deserialize <Tweet>(itemValue)); } return(tweets); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <Place> places = new List <Place>(); foreach (JsonValue itemValue in value.GetValue("result").GetValues("places")) { places.Add(mapper.Deserialize <Place>(itemValue)); } return(places); }
public object Deserialize(JsonValue value, JsonMapper mapper) { JsonValue searchMetadataValue = value.GetValue("search_metadata"); return new SearchResults() { Tweets = mapper.Deserialize<IList<Tweet>>(value.GetValue("statuses")), MaxId = searchMetadataValue.GetValue<long>("max_id"), SinceId = searchMetadataValue.GetValue<long>("since_id") }; }
public object Deserialize(JsonValue value, JsonMapper mapper) { CursoredList<UserList> userLists = new CursoredList<UserList>(); userLists.PreviousCursor = value.GetValue<long>("previous_cursor"); userLists.NextCursor = value.GetValue<long>("next_cursor"); foreach (JsonValue itemValue in value.GetValues("lists")) { userLists.Add(mapper.Deserialize<UserList>(itemValue)); } return userLists; }
public object Deserialize(JsonValue value, JsonMapper mapper) { JsonValue searchMetadataValue = value.GetValue("search_metadata"); return(new SearchResults() { Tweets = mapper.Deserialize <IList <Tweet> >(value.GetValue("statuses")), MaxId = searchMetadataValue.GetValue <long>("max_id"), SinceId = searchMetadataValue.GetValue <long>("since_id") }); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <TwitterProfile> twitterProfiles = new List <TwitterProfile>(); JsonValue usersValue = value.IsObject ? value.GetValue("users") : value; foreach (JsonValue itemValue in usersValue.GetValues()) { twitterProfiles.Add(mapper.Deserialize <TwitterProfile>(itemValue)); } return(twitterProfiles); }
public object Deserialize(JsonValue value, JsonMapper mapper) { CursoredList<TwitterProfile> twitterProfiles = new CursoredList<TwitterProfile>(); twitterProfiles.PreviousCursor = value.GetValue<long>("previous_cursor"); twitterProfiles.NextCursor = value.GetValue<long>("next_cursor"); foreach (JsonValue itemValue in value.GetValues("users")) { twitterProfiles.Add(mapper.Deserialize<TwitterProfile>(itemValue)); } return twitterProfiles; }
public object Deserialize(JsonValue json, JsonMapper mapper) { Event evt = null; if ( json != null && !json.IsNull ) { evt = new Event(); evt.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; evt.Name = json.ContainsName("name" ) ? json.GetValue<string>("name" ) : String.Empty; evt.Description = json.ContainsName("description" ) ? json.GetValue<string>("description") : String.Empty; evt.Location = json.ContainsName("location" ) ? json.GetValue<string>("location" ) : String.Empty; // 04/15/2012 Paul. Facebook uses ISO-8601 formatted date/time "yyyy-MM-ddTHH:mm:ss". evt.StartTime = json.ContainsName("start_time" ) ? JsonUtils.ToDateTime(json.GetValue<string>("start_time" ), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; evt.EndTime = json.ContainsName("end_time" ) ? JsonUtils.ToDateTime(json.GetValue<string>("end_time" ), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; evt.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; evt.Owner = mapper.Deserialize<Reference>(json.GetValue("owner")); evt.Venue = mapper.Deserialize<Location >(json.GetValue("venue")); evt.Privacy = PrivacyDeserializer(json.GetValue("privacy")); } return evt; }
public object Deserialize(JsonValue value, JsonMapper mapper) { CursoredList <UserList> userLists = new CursoredList <UserList>(); userLists.PreviousCursor = value.GetValue <long>("previous_cursor"); userLists.NextCursor = value.GetValue <long>("next_cursor"); foreach (JsonValue itemValue in value.GetValues("lists")) { userLists.Add(mapper.Deserialize <UserList>(itemValue)); } return(userLists); }
public object Deserialize(JsonValue value, JsonMapper mapper) { CursoredList <TwitterProfile> twitterProfiles = new CursoredList <TwitterProfile>(); twitterProfiles.PreviousCursor = value.GetValue <long>("previous_cursor"); twitterProfiles.NextCursor = value.GetValue <long>("next_cursor"); foreach (JsonValue itemValue in value.GetValues("users")) { twitterProfiles.Add(mapper.Deserialize <TwitterProfile>(itemValue)); } return(twitterProfiles); }
public void DeserializeKnownType() { JsonMapper mapper = new JsonMapper(); mapper.RegisterDeserializer(typeof(Class1), new Class1Deserializer()); JsonObject value = new JsonObject(); value.AddValue("ID", new JsonValue("007")); Class1 obj1 = mapper.Deserialize<Class1>(value); Assert.IsNotNull(obj1); Assert.AreEqual("007", obj1.ID); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Video video = null; if ( json != null && !json.IsNull ) { video = new Video(); video.ID = json.ContainsName("id" ) ? json.GetValue<string>("id" ) : String.Empty; video.Name = json.ContainsName("name" ) ? json.GetValue<string>("name" ) : String.Empty; video.Description = json.ContainsName("description" ) ? json.GetValue<string>("description") : String.Empty; video.Picture = json.ContainsName("picture" ) ? json.GetValue<string>("picture" ) : String.Empty; video.EmbedHtml = json.ContainsName("embed_html" ) ? json.GetValue<string>("embed_html" ) : String.Empty; video.Icon = json.ContainsName("icon" ) ? json.GetValue<string>("icon" ) : String.Empty; video.Source = json.ContainsName("source" ) ? json.GetValue<string>("source" ) : String.Empty; video.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue<string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; video.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue<string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; video.From = mapper.Deserialize<Reference >(json.GetValue("from" )); video.Tags = mapper.Deserialize<List<Tag >>(json.GetValue("tags" )); video.Comments = mapper.Deserialize<List<Comment>>(json.GetValue("comments")); } return video; }
public object Deserialize(JsonValue json, JsonMapper mapper) { WorkEntry entry = null; if ( json != null && !json.IsNull ) { entry = new WorkEntry(); entry.StartDate = json.ContainsName("start_date") ? json.GetValue<string>("start_date") : String.Empty; entry.EndDate = json.ContainsName("end_date" ) ? json.GetValue<string>("end_date" ) : String.Empty; entry.Employer = mapper.Deserialize<Reference>(json.GetValue("employer")); } return entry; }
public virtual object Deserialize(JsonValue json, JsonMapper mapper) { var jobList = new List<Job>(); foreach(var jobJson in json.GetValues()) { var job = mapper.Deserialize<Job>(jobJson); jobList.Add(job); } return jobList; }
public object Deserialize(JsonValue json, JsonMapper mapper) { WorkEntry entry = null; if (json != null && !json.IsNull) { entry = new WorkEntry(); entry.StartDate = json.ContainsName("start_date") ? json.GetValue <string>("start_date") : String.Empty; entry.EndDate = json.ContainsName("end_date") ? json.GetValue <string>("end_date") : String.Empty; entry.Employer = mapper.Deserialize <Reference>(json.GetValue("employer")); } return(entry); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Video video = null; if (json != null && !json.IsNull) { video = new Video(); video.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; video.Name = json.ContainsName("name") ? json.GetValue <string>("name") : String.Empty; video.Description = json.ContainsName("description") ? json.GetValue <string>("description") : String.Empty; video.Picture = json.ContainsName("picture") ? json.GetValue <string>("picture") : String.Empty; video.EmbedHtml = json.ContainsName("embed_html") ? json.GetValue <string>("embed_html") : String.Empty; video.Icon = json.ContainsName("icon") ? json.GetValue <string>("icon") : String.Empty; video.Source = json.ContainsName("source") ? json.GetValue <string>("source") : String.Empty; video.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; video.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue <string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; video.From = mapper.Deserialize <Reference>(json.GetValue("from")); video.Tags = mapper.Deserialize <List <Tag> >(json.GetValue("tags")); video.Comments = mapper.Deserialize <List <Comment> >(json.GetValue("comments")); } return(video); }
public object Deserialize(JsonValue json, JsonMapper mapper) { IList<Photo.Image> entries = null; if ( json != null && !json.IsNull ) { // 04/15/2012 Paul. Images is an array, not a data node. entries = new List<Photo.Image>(); foreach ( JsonValue itemValue in json.GetValues() ) { entries.Add(mapper.Deserialize<Photo.Image>(itemValue)); } } return entries; }
public object Deserialize(JsonValue json, JsonMapper mapper) { StatusPost post = null; if (json != null && !json.IsNull) { post = new StatusPost(); post.ID = json.ContainsName("id") ? json.GetValue <string>("id") : String.Empty; post.CreatedTime = json.ContainsName("created_time") ? JsonUtils.ToDateTime(json.GetValue <string>("created_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.UpdatedTime = json.ContainsName("updated_time") ? JsonUtils.ToDateTime(json.GetValue <string>("updated_time"), "yyyy-MM-ddTHH:mm:ss") : DateTime.MinValue; post.From = mapper.Deserialize <Reference>(json.GetValue("from")); } return(post); }
public object Deserialize(JsonValue json, JsonMapper mapper) { IList <Photo.Image> entries = null; if (json != null && !json.IsNull) { // 04/15/2012 Paul. Images is an array, not a data node. entries = new List <Photo.Image>(); foreach (JsonValue itemValue in json.GetValues()) { entries.Add(mapper.Deserialize <Photo.Image>(itemValue)); } } return(entries); }
public object Deserialize(JsonValue json, JsonMapper mapper) { Dictionary <int, List <StoryTag> > tags = null; if (json != null && !json.IsNull) { tags = new Dictionary <int, List <StoryTag> >(); int i = 0; foreach (JsonValue itemValue in json.GetValues()) { List <StoryTag> tagList = mapper.Deserialize <List <StoryTag> >(itemValue); tags.Add(i, tagList); i++; } } return(tags); }
public object Deserialize(JsonValue value, JsonMapper mapper) { IList <T> list = new List <T>(); if (value != null) { JsonValue usersValue = value.IsObject ? value.GetValue("values") : value; if (usersValue != null) { foreach (JsonValue itemValue in usersValue.GetValues()) { list.Add(mapper.Deserialize <T>(itemValue)); } } } return(list); }
public object Deserialize(JsonValue json, JsonMapper mapper) { IList <T> entries = null; if (json != null && !json.IsNull) { JsonValue dataNode = json.GetValue("data"); if (dataNode != null) { entries = new List <T>(); foreach (JsonValue itemValue in dataNode.GetValues()) { entries.Add(mapper.Deserialize <T>(itemValue)); } } } return(entries); }