本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetObject方法的具体用法?C# JObject.GetObject怎么用?C# JObject.GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GetObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TweetBlock
internal TweetBlock(string type, JObject obj, JObject data)
: base(type, obj)
{
Id = data.GetString("id");
Text = data.GetString("text");
User = data.GetObject("user", TweetUser.Parse);
CreatedAt = data.GetString("created_at", TwitterUtils.ParseDateTimeUtc);
StatusUrl = data.GetString("status_url");
Entities = data.GetObject("entities", TweetEntities.Parse);
}
示例2: PinterestPin
// metadata
#endregion
#region Constructors
private PinterestPin(JObject obj) {
Creator = obj.GetObject("creator", PinterestPinCreator.Parse);
Url = obj.GetString("url");
CreatedAt = obj.GetString("created_at", SocialDateTime.Parse);
Note = obj.GetString("note");
Color = obj.GetString("color");
Link = obj.GetString("link");
Board = obj.GetObject("board", PinterestPinBoard.Parse);
Counts = obj.GetObject("counts", PinterestPinCounts.Parse);
Id = obj.GetString("id");
}
示例3: PinterestUser
private PinterestUser(JObject obj) : base(obj) {
Username = obj.GetString("username");
Bio = obj.GetString("bio");
FirstName = obj.GetString("first_name");
LastName = obj.GetString("last_name");
AccountType = obj.GetString("account_type");
Url = obj.GetString("url");
CreatedAt = obj.GetString("created_at", SocialDateTime.Parse);
Image = obj.GetObject("image", PinterestUserImage.Parse);
Counts = obj.GetObject("counts", PinterestUserCounts.Parse);
Id = obj.GetString("id");
}
示例4: SpotifyArtist
private SpotifyArtist(JObject obj) : base(obj) {
ExternalUrls = obj.GetObject("external_urls", SpotifyArtistUrlCollection.Parse);
Followers = obj.GetObject("followers", SpotifyFollowers.Parse);
Genres = obj.GetStringArray("genres");
Href = obj.GetString("href");
Id = obj.GetString("id");
Images = obj.GetArray("images", SpotifyImage.Parse);
Name = obj.GetString("name");
Popularity = obj.GetInt32("popularity");
Type = obj.GetString("type");
Uri = obj.GetString("uri");
}
示例5: Parse
public static Category Parse(JObject obj)
{
if (obj == null)
return null;
Category item = new Category();
item.name = obj.GetObject<string>("name");
item.id = obj.GetObject<string>("id");
item.urlname = obj.GetObject<string>("urlname");
item.nav_link = $"favorite/{item.urlname}";
return item;
}
示例6: BoxFolderInfo
private BoxFolderInfo(JObject obj) : base(obj) {
Type = obj.GetString("type");
Id = obj.GetString("id");
Name = obj.GetString("name");
CreatedAt = obj.GetString("created_at", SocialDateTime.Parse);
ModifiedAt = obj.GetString("modified_at", SocialDateTime.Parse);
Description = obj.GetString("description");
Size = obj.GetInt64("size");
CreatedBy = obj.GetObject("created_by", BoxUserInfo.Parse);
ModifiedBy = obj.GetObject("modified_by", BoxUserInfo.Parse);
TrashedAt = obj.GetString("trashed_at", SocialDateTime.Parse);
PurgedAt = obj.GetString("purged_at", SocialDateTime.Parse);
ContentCreatedAt = obj.GetString("content_created_at", SocialDateTime.Parse);
ContentModifiedAt = obj.GetString("content_modified_at", SocialDateTime.Parse);
OwnedBy = obj.GetObject("owned_by", BoxUserInfo.Parse);
}
示例7: Parse
/// <summary>
/// Gets a macro value from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="control">The parent control.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridControlMacroValue Parse(GridControl control, JObject obj) {
if (obj == null) return null;
return new GridControlMacroValue(control, obj) {
Syntax = obj.GetString("syntax"),
MacroAlias = obj.GetString("macroAlias"),
Parameters = obj.GetObject("macroParamsDictionary").ToObject<Dictionary<string, object>>()
};
}
示例8: MailChimpMetadata
private MailChimpMetadata(JObject obj) : base(obj) {
DataCenter = obj.GetString("dc");
AccountName = obj.GetString("accountname");
Role = obj.GetString("role");
UserId = obj.GetInt64("user_id");
Login = obj.GetObject("login", MailChimpMetadataLogin.Parse);
LoginUrl = obj.GetString("login_url");
ApiEndpoint = obj.GetString("api_endpoint");
}
示例9: Parse
/// <summary>
/// Gets a media value from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="control">The parent control.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridControlMediaValue Parse(GridControl control, JObject obj) {
if (obj == null) return null;
return new GridControlMediaValue(obj) {
Control = control,
FocalPoint = obj.GetObject("focalPoint", GridControlMediaFocalPoint.Parse),
Id = obj.GetInt32("id"),
Image = obj.GetString("image"),
Caption = obj.GetString("caption")
};
}
示例10: Parse
public static ImageFile Parse(JObject obj)
{
if (obj == null)
return null;
var file = new ImageFile();
file.fileid = obj.GetObject<string>("id");
file.type = obj.GetObject<string>("type");
file.farm = obj.GetObject<string>("farm");
file.bucket = obj.GetObject<string>("bucket");
file.key = obj.GetObject<string>("key");
file.width = obj.GetObject<int>("width");
file.height = obj.GetObject<int>("height");
file.key = obj.GetObject<string>("key");
return file;
}
示例11: ImagePickerItem
/// <summary>
/// Initializes a new image picker item based on the specified <see cref="JObject"/>.
/// </summary>
/// <param name="obj">An instanceo of <see cref="JObject"/> representing the item.</param>
protected ImagePickerItem(JObject obj) {
JObject = obj;
Image = obj.GetInt32("imageId", ImagePickerImage.GetFromId);
Title = obj.GetString("title") ?? "";
Description = obj.GetString("description") ?? "";
Link = obj.GetObject("link", LinkPickerItem.Parse) ?? LinkPickerItem.Parse(new JObject());
}
示例12: Parse
public static Pin Parse(JObject obj, bool deptParse = false)
{
if (obj == null)
return null;
Pin item = new Pin();
item.pin_id = obj.GetObject<string>("pin_id");
item.user_id = obj.GetObject<string>("user_id");
item.board_id = obj.GetObject<string>("board_id");
item.file_id = obj.GetObject<string>("file_id");
item.seq = obj.GetObject<string>("seq");
item.media_type = obj.GetObject<string>("media_type");
item.source = obj.GetObject<string>("source");
item.link = obj.GetObject<string>("link");
item.raw_text = HtmlDecode(obj.GetObject<string>("raw_text"));
item.via = obj.GetObject<string>("via");
item.original = obj.GetObject<string>("original");
item.created_at = obj.GetObject<string>("created_at");
item.like_count = obj.GetObject<string>("like_count");
item.comment_count = obj.GetObject<string>("comment_count");
item.repin_count = obj.GetObject<string>("repin_count");
item.orig_source = obj.GetObject<string>("orig_source");
item.file = ImageFile.Parse(obj["file"] as JObject);
item.liked = obj.GetObject<bool>("liked");
item.user = User.Parse(obj["user"] as JObject);
item.board = Board.Parse(obj["board"] as JObject);
if (deptParse)
{
item.repins = Pin.ParseList(obj["repins"] as JArray, false);
item.comments = Comment.ParseList(obj["repins"] as JArray, false);
item.likes = User.ParseList(obj["likes"] as JArray, false);
}
return item;
}
示例13: Parse
/// <summary>
/// Parses a row from the specified <code>obj</code>.
/// </summary>
/// <param name="section">The parent section of the row.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridRow Parse(GridSection section, JObject obj) {
// Some input validation
if (obj == null) throw new ArgumentNullException("obj");
// Parse basic properties
GridRow row = new GridRow(obj) {
Section = section,
Id = obj.GetString("id"),
Alias = obj.GetString("alias"),
Name = obj.GetString("name"),
Styles = obj.GetObject("styles", GridDictionary.Parse),
Config = obj.GetObject("config", GridDictionary.Parse)
};
// Parse the areas
row.Areas = obj.GetArray("areas", x => GridArea.Parse(row, x)) ?? new GridArea[0];
// Update "PreviousArea" and "NextArea" properties
for (int i = 1; i < row.Areas.Length; i++) {
row.Areas[i - 1].NextArea = row.Areas[i];
row.Areas[i].PreviousArea = row.Areas[i - 1];
}
// Return the row
return row;
}
示例14: Parse
public static Board Parse(JObject obj, bool deptParse = false)
{
if (obj == null)
return null;
Board board = new Board();
try
{
if (obj.GetObject<int>("is_private") > 0)
return null;
board.board_id = obj.GetObject<string>("board_id");
board.user_id = obj.GetObject<string>("user_id");
board.description = obj.GetObject<string>("description");
board.title = HtmlDecode(obj.GetObject<string>("title"));
board.category_id = obj.GetObject<string>("category_id");
board.pin_count = obj.GetObject<string>("pin_count");
board.follow_count = obj.GetObject<string>("follow_count");
board.like_count = obj.GetObject<string>("like_count");
board.created_at = obj.GetObject<string>("created_at");
board.updated_at = obj.GetObject<string>("updated_at");
board.following = obj.GetObject<bool>("following");
board.user = User.Parse(obj["user"] as JObject);
board.cover = Pin.Parse(obj["cover"] as JObject);
board.seq = obj.GetObject<int>("seq");
board.pins = Pin.ParseList(obj["pins"] as JArray);
if (board.cover == null && board.pins != null && board.pins.Count > 0)
board.cover = board.pins[0];
}
catch (Exception ex)
{
string aaa = ex.Message;
}
return board;
}
示例15: Parse
/// <summary>
/// Parses an area from the specified <code>obj</code>.
/// </summary>
/// <param name="row">The parent row of the area.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridArea Parse(GridRow row, JObject obj) {
// Some input validation
if (obj == null) throw new ArgumentNullException("obj");
// Parse the array of allow blocks
JArray allowed = obj.GetArray("allowed");
// Parse basic properties
GridArea area = new GridArea(obj) {
Row = row,
Grid = obj.GetInt32("grid"),
AllowAll = obj.GetBoolean("allowAll"),
Allowed = allowed == null ? new string[0] : allowed.Select(x => (string)x).ToArray(),
Styles = obj.GetObject("styles", GridDictionary.Parse),
Config = obj.GetObject("config", GridDictionary.Parse)
};
// Parse the controls
area.Controls = obj.GetArray("controls", x => GridControl.Parse(area, x)) ?? new GridControl[0];
// Update "PreviousArea" and "NextArea" properties
for (int i = 1; i < area.Controls.Length; i++) {
area.Controls[i - 1].NextControl = area.Controls[i];
area.Controls[i].PreviousControl = area.Controls[i - 1];
}
// Return the row
return area;
}