コード例 #1
0
        public static User DeserializeUser(string value)
        {
            JsonArrayWrapper      arrayWrapper   = JsonConvert.DeserializeObject <JsonArrayWrapper>(value);
            IEnumerable <JObject> jsonArray      = arrayWrapper.Value;
            JsonSerializer        jsonSerializer = JsonSerializer.Create(jSONSettings);

            foreach (JObject jObject in jsonArray)
            {
                string entityJson = jObject.ToString();

                // Should only be one.
                return(JsonConvert.DeserializeObject <User>(entityJson, jSONSettings));
            }

            return(null);
        }
コード例 #2
0
        public static List <UserPFXCertificate> DeserializeUserPFXCertificateList(string value)
        {
            JsonArrayWrapper          arrayWrapper   = JsonConvert.DeserializeObject <JsonArrayWrapper>(value);
            IEnumerable <JObject>     jsonArray      = arrayWrapper.Value;
            JsonSerializer            jsonSerializer = JsonSerializer.Create(jSONSettings);
            List <UserPFXCertificate> entityList     = new List <UserPFXCertificate>();

            foreach (JObject jObject in jsonArray)
            {
                string             entityJson = jObject.ToString();
                UserPFXCertificate entity     = DeserializeUserPFXCertificate(entityJson);
                entityList.Add(entity);
            }

            return(entityList);
        }