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); }
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); }