I have this code in c# that gives me a dictionary of my data by date, it works perfect except when the key is serialized into json. the json ends up to be just the toString() property of the class instead of the property name and value I expect. Items in the collection for each of the keys serialize fine. This is my code:
list = m
.GroupBy(x => new StatCallDateModel { DateText = x.DateText })
.ToDictionary(x => x.Key, x => x.ToList()
.ConvertAll(c => (object)new { Agent = c.Agent, Talk = c.Talk }));
return list;
One thing I did notice was that when I add the date object to the collection under the key the json parses fine. It is just the fact that it is a key in a dictionary that makes it parse like this. I am using this code to form the json for d3 charts; so the format is important.
Is there a way around this or can I get json similar to this without a dictionary?