本文整理汇总了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;
}
示例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;
}
示例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
};
}
示例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
};
}
示例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")
};
}
示例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)
};
}
示例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")
};
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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)
};
}
示例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;
}
示例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")
};
}
示例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;
}