DeserializeObject question

May 19, 2010 at 6:48 PM
I saw a similar question in this thread, but no one answered it. I'm having a hard time deserializing the following: { "dtCase": [ { "CaseNumber": "A123456", "Guid": "99" } ] } I tried to declare my class as follows: public class NewCase { public string dt { get; set; } public Dictionary<string, QueryItem> Items { get; set; } public class QueryItem { public string CaseId { get; set; } public string Guid { get; set; } } } and I also tried this: public class NewCaseCollection { public List<NewCase> NewCases { get; set; } } public class NewCase { public string CaseId { get; set; } public string Guid { get; set; } } And executing : NewCaseCollection obj = JsonConvert.DeserializeObject<NewCaseCollection>(actual); But I always get a null. Thanks Alex
May 19, 2010 at 6:52 PM
I'm sorry, I'm not sure why it palced all the text in one blob... I saw a similar question in this thread, but no one answered it. I'm having a hard time deserializing the following: { "dtCase": [ { "CaseNumber": "A123456", "Guid": "99" } ] } I tried to declare my class as follows: public class NewCase { public string dt { get; set; } public Dictionary<string, QueryItem> Items { get; set; } public class QueryItem { public string CaseId { get; set; } public string Guid { get; set; } } } and I also tried this: public class NewCaseCollection { public List<NewCase> NewCases { get; set; } } public class NewCase { public string CaseId { get; set; } public string Guid { get; set; } } And executing : NewCaseCollection obj = JsonConvert.DeserializeObject<NewCaseCollection>(actual); But I always get a null. Thanks Alex