当前位置: 首页>>代码示例>>C#>>正文


C# JsonValue.GetValue方法代码示例

本文整理汇总了C#中JsonValue.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# JsonValue.GetValue方法的具体用法?C# JsonValue.GetValue怎么用?C# JsonValue.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonValue的用法示例。


在下文中一共展示了JsonValue.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SearchResults

        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;
        }
开发者ID:javaday,项目名称:Spring.Social.oDesk,代码行数:32,代码来源:SearchResultsDeserializer.cs

示例2: Deserialize

		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;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:29,代码来源:CommentDeserializer.cs

示例3: Deserialize

 public object Deserialize(JsonValue value, JsonMapper mapper)
 {
     return new DropboxLink()
     {
         Url = value.GetValue<string>("url"),
         ExpireDate = JsonUtils.ToDropboxDateTime(value.GetValue<string>("expires")).Value
     };
 }
开发者ID:gultekinbozkurt,项目名称:spring-net-social-dropbox,代码行数:8,代码来源:DropboxLinkDeserializer.cs

示例4: Deserialize

 public object Deserialize(JsonValue value, JsonMapper mapper)
 {
     return new FileRef()
     {
         Value = value.GetValue<string>("copy_ref"),
         ExpireDate = JsonUtils.ToDropboxDateTime(value.GetValue<string>("expires")).Value
     };
 }
开发者ID:gultekinbozkurt,项目名称:spring-net-social-dropbox,代码行数:8,代码来源:FileRefDeserializer.cs

示例5: Deserialize

 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")
     };
 }
开发者ID:erijss,项目名称:spring-net-social-twitter,代码行数:9,代码来源:SearchResultsDeserializer.cs

示例6: Deserialize

 public object Deserialize(JsonValue value, JsonMapper mapper)
 {
     return new RateLimitStatus()
     {
         HourlyLimit = value.GetValue<int>("hourly_limit"),
         RemainingHits = value.GetValue<int>("remaining_hits"),
         ResetTime = JsonUtils.ToDateTime(value.GetValue<string>("reset_time"), RATE_LIMIT_STATUS_DATE_FORMAT)
     };
 }
开发者ID:erijss,项目名称:spring-net-social-twitter,代码行数:9,代码来源:RateLimitStatusDeserializer.cs

示例7: Deserialize

 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")
     };
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:10,代码来源:SearchResultsDeserializer.cs

示例8: Deserialize

        public virtual object Deserialize(JsonValue json, JsonMapper mapper)
        {
            PaginatedResult paginatedResult = this.CreatePaginatedResult();

            paginatedResult.Total = json.GetValue<int>("_total");
            paginatedResult.Start = json.ContainsName("_start") ? json.GetValue<int>("_start") : 0;
            paginatedResult.Count = json.ContainsName("_count") ? json.GetValue<int>("_count") : paginatedResult.Total;            

            return paginatedResult;
        }
开发者ID:poundingCode,项目名称:spring-net-social-linkedin,代码行数:10,代码来源:PaginatedResultDeserializer.cs

示例9: Deserialize

 public object Deserialize(JsonValue value, JsonMapper mapper)
 {
     CursoredList<long> cursoredList = new CursoredList<long>();
     cursoredList.PreviousCursor = value.GetValue<long>("previous_cursor");
     cursoredList.NextCursor = value.GetValue<long>("next_cursor");
     foreach (JsonValue itemValue in value.GetValues("ids"))
     {
         cursoredList.Add(itemValue.GetValue<long>());
     }
     return cursoredList;
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:11,代码来源:CursoredLongListDeserializer.cs

示例10: Deserialize

 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;
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:11,代码来源:CursoredUserListListDeserializer.cs

示例11: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			Reference reference = null;
			if ( json != null && !json.IsNull )
			{
				reference = new Reference();
				reference.ID   = json.ContainsName("id"  ) ? json.GetValue<string>("id"  ) : String.Empty;
				reference.Name = json.ContainsName("name") ? json.GetValue<string>("name") : String.Empty;
			}
			return reference;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:11,代码来源:ReferenceDeserializer.cs

示例12: Deserialize

 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)
     };
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:11,代码来源:DirectMessageDeserializer.cs

示例13: Deserialize

 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;
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:11,代码来源:CursoredTwitterProfileListDeserializer.cs

示例14: Deserialize

 public object Deserialize(JsonValue value, JsonMapper mapper)
 {
     return new SavedSearch()
     {
         ID = value.GetValue<long>("id"),
         Name = value.GetValue<string>("name"),
         Query = value.GetValue<string>("query"),
         CreatedAt = JsonUtils.ToDateTime(value.GetValue<string>("created_at"), SAVED_SEARCH_DATE_FORMAT),
         Position = value.GetValue<int>("position")
     };
 }
开发者ID:kisspa,项目名称:spring-net-social-twitter,代码行数:11,代码来源:SavedSearchDeserializer.cs

示例15: Deserialize

		public object Deserialize(JsonValue json, JsonMapper mapper)
		{
			FamilyMember family = null;
			if ( json != null && !json.IsNull )
			{
				family = new FamilyMember();
				family.ID           = json.ContainsName("id"          ) ? json.GetValue<string>("id"          ) : String.Empty;
				family.Name         = json.ContainsName("name"        ) ? json.GetValue<string>("name"        ) : String.Empty;
				family.Relationship = json.ContainsName("relationship") ? json.GetValue<string>("relationship") : String.Empty;
			}
			return family;
		}
开发者ID:kisspa,项目名称:spring-net-social-facebook,代码行数:12,代码来源:FamilyMemberDeserializer.cs


注:本文中的JsonValue.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。