本文整理汇总了C#中JsonObject.GetArray方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetArray方法的具体用法?C# JsonObject.GetArray怎么用?C# JsonObject.GetArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.GetArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static TwitterHashTagEntitity Parse(JsonObject entity) {
return new TwitterHashTagEntitity {
Text = entity.GetString("text"),
StartIndex = entity.GetArray("indices").GetInt(0),
EndIndex = entity.GetArray("indices").GetInt(1)
};
}
示例2: Parse
public static TwitterCoordinates Parse(JsonObject obj) {
if (obj == null) return null;
return new TwitterCoordinates(obj) {
Latitude = obj.GetArray("coordinates").GetDouble(1),
Longitude = obj.GetArray("coordinates").GetDouble(0)
};
}
示例3: Parse
public static TwitterStatusMessageEntities Parse(JsonObject entities) {
if (entities == null) return null;
return new TwitterStatusMessageEntities {
HashTags = TwitterHashTagEntitity.ParseMultiple(entities.GetArray("hashtags")).ToArray(),
Urls = TwitterUrlEntitity.ParseMultiple(entities.GetArray("urls")).ToArray(),
Mentions = TwitterMentionEntity.ParseMultiple(entities.GetArray("user_mentions")).ToArray(),
Media = TwitterMediaEntity.ParseMultiple(entities.GetArray("media")).ToArray()
};
}
示例4: Parse
public static TwitterStatusMessageEntities Parse(JsonObject entities) {
if (entities == null) return null;
return new TwitterStatusMessageEntities {
HashTags = entities.GetArray("hashtags", TwitterHashTagEntity.Parse),
Urls = entities.GetArray("urls", TwitterUrlEntity.Parse),
Mentions = entities.GetArray("user_mentions", TwitterMentionEntity.Parse),
Media = entities.GetArray("media", TwitterMediaEntity.Parse) ?? new TwitterMediaEntity[0]
};
}
示例5: Parse
public static TwitterUrlEntity Parse(JsonObject entity) {
return new TwitterUrlEntity {
Url = entity.GetString("url"),
ExpandedUrl = entity.GetString("expanded_url"),
DisplayUrl = entity.GetString("display_url"),
StartIndex = entity.GetArray("indices").GetInt32(0),
EndIndex = entity.GetArray("indices").GetInt32(1)
};
}
示例6: Parse
public static TwitterMentionEntity Parse(JsonObject mention) {
return new TwitterMentionEntity {
UserId = mention.GetLong("id"),
UserIdStr = mention.GetString("id_str"),
ScreenName = mention.GetString("screen_name"),
Name = mention.GetString("name"),
StartIndex = mention.GetArray("indices").GetInt(0),
EndIndex = mention.GetArray("indices").GetInt(1)
};
}
示例7: Parse
/// <summary>
/// Parse the JSON object of an account.
/// </summary>
/// <param name="obj">The JSON object.</param>
/// <returns></returns>
public static FacebookAccount Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookAccount(obj) {
Id = obj.GetString("id"),
Name = obj.GetString("name"),
Category = obj.GetString("category"),
CategoryList = obj.GetArray("category_list", FacebookObject.Parse),
AccessToken = obj.GetString("access_token"),
Permissions = obj.GetArray<string>("perms") ?? new string[0]
};
}
示例8: Parse
public static TwitterMediaEntity Parse(JsonObject entity) {
return new TwitterMediaEntity {
Id = entity.GetInt64("id"),
IdStr = entity.GetString("id_str"),
StartIndex = entity.GetArray("indices").GetInt32(0),
EndIndex = entity.GetArray("indices").GetInt32(1),
MediaUrl = entity.GetString("media_url"),
MediaUrlHttps = entity.GetString("media_url_https"),
Url = entity.GetString("url"),
DisplayUrl = entity.GetString("display_url"),
ExpandedUrl = entity.GetString("expanded_url"),
Type = entity.GetString("type")
};
}
示例9: Parse
/// <summary>
/// Gets an instance of <code>YouTubeChannelList</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static YouTubeChannelList Parse(JsonObject obj) {
if (obj == null) return null;
return new YouTubeChannelList(obj) {
PageInfo = obj.GetObject("pageInfo", YouTubePageInfo.Parse),
Items = obj.GetArray("items", YouTubeChannel.Parse)
};
}
示例10: Parse
public static BitBucketCurrentUserResponseBody Parse(JsonObject obj) {
if (obj == null) return null;
return new BitBucketCurrentUserResponseBody(obj) {
User = obj.GetObject("user", BitBucketUser.Parse),
Repositories = obj.GetArray("repositories", BitBucketUserRepository.Parse)
};
}
示例11: Parse
/// <summary>
/// Gets a post from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static FacebookPost Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookPost(obj) {
Id = obj.GetString("id"),
From = obj.GetObject("from", FacebookObject.Parse),
Application = obj.GetObject("application", FacebookObject.Parse),
Properties = obj.GetArray("properties", FacebookPostProperties.Parse) ?? new FacebookPostProperties[0],
Caption = obj.GetString("caption"),
Message = obj.GetString("message"),
Description = obj.GetString("description"),
Story = obj.GetString("story"),
Picture = obj.GetString("picture"),
Link = obj.GetString("link"),
Source = obj.GetString("source"),
Name = obj.GetString("name"),
Icon = obj.GetString("icon"),
Type = obj.GetString("type"),
StatusType = obj.GetString("status_type"),
ObjectId = obj.GetString("object_id"),
CreatedTime = obj.GetDateTime("created_time"),
UpdatedTime = obj.GetDateTime("updated_time"),
Shares = obj.GetObject("shares", FacebookShares.Parse),
Likes = obj.GetObject("likes", FacebookLikes.Parse),
Comments = obj.GetObject("comments", FacebookComments.Parse)
};
}
示例12: Parse
/// <summary>
/// Gets an instance of <code>FacebookDebugTokenData</code> from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static FacebookDebugTokenData Parse(JsonObject obj) {
// Check if NULL
if (obj == null) return null;
// If an access token doesn't have an expire date, it may be specified as "0". In other scenarios, the
// property is not present at all. In either case, we should set the "ExpiresAt" property to "NULL".
DateTime? expiresAt = null;
if (obj.HasValue("expires_at")) {
int value = obj.GetInt32("expires_at");
if (value > 0) expiresAt = SocialUtils.GetDateTimeFromUnixTime(value);
}
// Parse the array of scopes
FacebookScope[] scopes = (
from name in obj.GetArray<string>("scopes") ?? new string[0]
select FacebookScope.GetScope(name) ?? new FacebookScope(name)
).ToArray();
// Initialize the instance of FacebookDebugTokenData
return new FacebookDebugTokenData(obj) {
AppId = obj.GetInt64("app_id"),
Application = obj.GetString("application"),
ExpiresAt = expiresAt,
IsValid = obj.GetBoolean("is_valid"),
IssuedAt = obj.HasValue("issued_at") ? (DateTime?) obj.GetDateTimeFromUnixTimestamp("issued_at") : null,
UserId = obj.GetString("user_id"),
Scopes = scopes
};
}
示例13: Parse
public static FacebookLikes Parse(JsonObject obj) {
if (obj == null) return new FacebookLikes { Data = new FacebookObject[0] };
return new FacebookLikes {
Count = obj.GetInt("count"),
Data = obj.GetArray("data", FacebookObject.Parse) ?? new FacebookObject[0]
};
}
示例14: Parse
public static TwitterSearchTweetsResults Parse(JsonObject obj) {
if (obj == null) return null;
return new TwitterSearchTweetsResults(obj) {
Statuses = obj.GetArray("statuses", TwitterStatusMessage.Parse),
MetaData = obj.GetObject("search_metadata", TwitterSearchTweetsMetaData.Parse)
};
}
示例15: Parse
public static FacebookPhotosCollection Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookPhotosCollection(obj) {
Data = obj.GetArray("data", FacebookPhoto.Parse),
Paging = obj.GetObject("paging", FacebookCursorBasedPagination.Parse)
};
}