KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to deserialize the following JSON response (using Json.NET): [ { "0": "Yes", "1": "No", "pollid": "1", "question": "This is a test", "start": "2011-06-28", "end": "2012-03-21", "category": "Roads" } ] ... Into objects of this type: class Poll { [JsonProperty("pollid")] public int pollid { get; set; } [JsonProperty("question")] public string question { get; set; } [JsonProperty("start")] public DateTime start { get; set; } [JsonProperty("end")] public DateTime end { get; set; } [JsonProperty("category")] public string category { get; set; } // PROBLEM AREA [JsonProperty("0")] // Json parameter names are 0 to 9. How can I 'match' these to the List elements? public List<string> polloptions { get; set; } } How would I use the [JsonProperty] attribute when creating a List? (Assuming the JSON parameter names to be contained in this List are "0" to "9"). I've spent the last few hours trying different methods without any luck.
Tags (comma-separated)
Save Edits
Cancel