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


C# JObject.SelectToken方法代码示例

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


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

示例1: ParsePlayer

 public void ParsePlayer(JObject playerObject)
 {
     Name = (string)playerObject.SelectToken("name");
     Stack = (int)playerObject.SelectToken("stack");
     Status = (string)playerObject.SelectToken("status");
     Bet = (int)playerObject.SelectToken("bet");
     Version = (string)playerObject.SelectToken("version");
 }
开发者ID:Sholy,项目名称:poker-player-shoe-people,代码行数:8,代码来源:Player.cs

示例2: GeniAuthenticatedContext

 /// <summary>
 /// Initializes a <see cref="GeniAuthenticatedContext"/>
 /// </summary>
 /// <param name="context">The OWIN environment</param>
 /// <param name="user">The Geni user information</param>
 /// <param name="accessToken">Geni Access token</param>
 /// <param name="refreshToken">Geni Refresh token</param>
 public GeniAuthenticatedContext(IOwinContext context, JObject user, string accessToken, string refreshToken)
     : base(context)
 {
     AccessToken = accessToken;
     RefreshToken = refreshToken;
     User = user;
     Name = user.SelectToken("name").ToString();
     Id = user.SelectToken("translator_id").ToString();
 }
开发者ID:davetimmins,项目名称:OwinOAuthProviders,代码行数:16,代码来源:GeniAuthenticatedContext.cs

示例3: ServiceEndpoint

 /// <summary>
 /// Creates a new Service Endpoint instance
 /// </summary>
 /// <param name="obj">JSON Object representing the Endpoint</param>
 internal ServiceEndpoint(JObject obj)
 {
     this._uri = (String)obj.SelectToken("url");
     JToken methods = obj.SelectToken("http-methods");
     foreach (JToken method in methods.Children())
     {
         this._methods.Add((String)method);
     }
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:13,代码来源:ServiceEndpoint.cs

示例4: FitbitAuthenticatedContext

 /// <summary>
 /// Initializes a <see cref="FitbitAuthenticatedContext"/>
 /// </summary>
 /// <param name="context">The OWIN environment</param>
 /// <param name="user">The Fitbit user information</param>
 /// <param name="accessToken">Fitbit Access token</param>
 /// <param name="refreshToken">Fitbit Refresh token</param>
 public FitbitAuthenticatedContext(IOwinContext context, JObject user, string accessToken, string refreshToken)
     : base(context)
 {
     AccessToken = accessToken;
     RefreshToken = refreshToken;
     User = user;
     Name = user.SelectToken("user.displayName").ToString();
     Id = user.SelectToken("user.encodedId").ToString();
 }
开发者ID:uhavemyword,项目名称:OwinOAuthProviders,代码行数:16,代码来源:FitbitAuthenticatedContext.cs

示例5: PelletService

 /// <summary>
 /// Creates a new Pellet Service instance
 /// </summary>
 /// <param name="name">Service Name</param>
 /// <param name="obj">JSON Object representing the Service</param>
 protected PelletService(String name, JObject obj)
 {
     this._name = name;
     JToken mimeTypes = obj.SelectToken("response-mimetype");
     foreach (JToken mimeType in mimeTypes.Children())
     {
         this._mimeTypes.Add((String)mimeType);
     }
     this._endpoint = new ServiceEndpoint((JObject)obj.SelectToken("endpoint"));
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:15,代码来源:PelletService.cs

示例6: ParseParlamentaryGroup

 public ParlamentaryGroup ParseParlamentaryGroup(JObject jobject)
 {
     return new ParlamentaryGroup()
     {
         Acronym = jobject.SelectToken(c_acronym).ValueOrDefault<string>(),
         CongressUrl = jobject.SelectToken(c_congressUrl).ValueOrDefault<string>(),
         Id = jobject.SelectToken(c_id).ValueOrDefault<int>()  ,
         ParlamentaryMembers = ParseParlamentaryMembers((JArray)jobject.SelectToken(c_members))          
     };
 }
开发者ID:jmmortega,项目名称:PicaFlor,代码行数:10,代码来源:PicaFlorJsonHelper.cs

示例7: DeserializeWrapper

        /// <summary>
        /// This method is copied out of the TwitterUserCollection class.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        internal static TwitterUserCollection DeserializeWrapper(JObject value)
        {
            if (value == null || value.SelectToken("users") == null)
                return null;

            TwitterUserCollection result = JsonConvert.DeserializeObject<TwitterUserCollection>(value.SelectToken("users").ToString());
            //result.NextCursor = value.SelectToken("next_cursor").Value<long>();
            //result.PreviousCursor = value.SelectToken("previous_cursor").Value<long>();

            return result;
        }
开发者ID:JohnSmithJS,项目名称:Twitterizer,代码行数:16,代码来源:Issue120.cs

示例8: EvaluateEmptyString

        public void EvaluateEmptyString()
        {
            JObject o = new JObject(
                new JProperty("Blah", 1));

            JToken t = o.SelectToken("");
            Assert.AreEqual(o, t);

            t = o.SelectToken("['']");
            Assert.AreEqual(null, t);
        }
开发者ID:GhostitosHunter,项目名称:Newtonsoft.Json,代码行数:11,代码来源:JPathExecuteTests.cs

示例9: ExtractMetadata

 public override CldrJsonMetadata ExtractMetadata(JObject obj)
 {
     return new CldrJsonMetadata
     {
         CldrVersion = obj.SelectToken("segments.identity.version._cldrVersion").ToString(),
         CldrLocale = new CldrLocale(
             language: obj.SelectToken("segments.identity.language").ToString(),
             script: obj.SelectToken("segments.identity.script")?.ToString(),
             territory: obj.SelectToken("segments.identity.territory")?.ToString(),
             variant: obj.SelectToken("segments.identity.variant")?.ToString()
         )
     };
 }
开发者ID:pgolebiowski,项目名称:onism-cldr,代码行数:13,代码来源:SegmentsParser.cs

示例10: ExtractMetadata

 public override CldrJsonMetadata ExtractMetadata(JObject obj)
 {
     return new CldrJsonMetadata
     {
         CldrVersion = obj.SelectToken("supplemental.version._cldrVersion").ToString()
     };
 }
开发者ID:pgolebiowski,项目名称:onism-cldr,代码行数:7,代码来源:SupplementalParser.cs

示例11: ApigeeResponse

 public ApigeeResponse(JObject rawData, string wantedKey) {
     RawResponse = rawData.ToString();
     try
     {
         this.ResponseData = rawData.SelectToken(wantedKey, true);
         this.success = true;
     }
     catch (Exception)
     {
         var errorMsg = rawData.SelectToken("error_description").ToString();
         if (String.IsNullOrEmpty(errorMsg))
             errorMsg = "Unknown Error";
         
         this.Error = new ApigeeResponseError(errorMsg);
         this.success = false;
     }
 }
开发者ID:zaxy78,项目名称:Apigee.Net,代码行数:17,代码来源:ApigeeResponse.cs

示例12: EvaluateEmptyStringWithMatchingEmptyProperty

        public void EvaluateEmptyStringWithMatchingEmptyProperty()
        {
            JObject o = new JObject(
                new JProperty(" ", 1));

            JToken t = o.SelectToken("[' ']");
            Assert.AreEqual(1, (int)t);
        }
开发者ID:GhostitosHunter,项目名称:Newtonsoft.Json,代码行数:8,代码来源:JPathExecuteTests.cs

示例13: GetText

 public static string GetText(JObject obj, string path)
 {
     string id = null;
       var idEl = obj.SelectToken(path, false);
       if (idEl != null)
     id = idEl.Value<string>();
       return id;
 }
开发者ID:Q42,项目名称:MWHackathon,代码行数:8,代码来源:JSONService.cs

示例14: EvaluateEmptyPropertyIndexer

        public void EvaluateEmptyPropertyIndexer()
        {
            JObject o = new JObject(
                new JProperty("", 1));

            JToken t = o.SelectToken("['']");
            Assert.AreEqual(1, (int)t);
        }
开发者ID:andersonb,项目名称:Newtonsoft.Json,代码行数:8,代码来源:JPathExecuteTests.cs

示例15: EvaluateDollarString

        public void EvaluateDollarString()
        {
            JObject o = new JObject(
                new JProperty("Blah", 1));

            JToken t = o.SelectToken("$");
            Assert.AreEqual(o, t);
        }
开发者ID:sitty,项目名称:Newtonsoft.Json,代码行数:8,代码来源:JPathExecuteTests.cs


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