Exemplo n.º 1
0
        public static void TryParse(string input, out JoseHeader joseHeader)
        {
            joseHeader = null;
            IJsonSerializer jsonSerializer = new DefaultJsonSerializer();

            try
            {
                joseHeader = jsonSerializer.Deserialize <JoseHeader>(input);
            }
            catch { }
        }
Exemplo n.º 2
0
        public static bool TryParse(string input, out JsonWebTokenClaim claim)
        {
            claim = null;
            Dictionary <string, object> items          = null;
            IJsonSerializer             jsonSerializer = new DefaultJsonSerializer();

            try
            {
                items = jsonSerializer.Deserialize <Dictionary <string, object> >(input);
                if (items != null)
                {
                    claim = new JsonWebTokenClaim();
                    foreach (var item in items)
                    {
                        claim.Add(item.Key, item.Value);
                    }
                }
                return(true);
            }
            catch { }
            return(false);
        }