Deserialize Date Array

May 28, 2009 at 11:43 PM
Edited May 28, 2009 at 11:45 PM


Is there any way to desearialize a date array? What is the best way, I can't seem to find any real answers on the net.

This is the data

{"as_of":1243520460,"trends":{"2009-05-28 14:21:00":[{"query":"#liesgirlstell","name":"#liesgirlstell"},{"query":"#itsucks","name":"#itsucks"},{"query":"#3wordsaftersex","name":"#3wordsaftersex"},{"query":"#3breakupwords","name":"#3breakupwords"},{"query":"#Twialogues","name":"#Twialogues"},{"query":"AOL","name":"AOL"},{"query":"\"Susan Boyle\"","name":"Susan Boyle"},{"query":"#jonaswebcast","name":"#jonaswebcast"},{"query":"\"Time Warner\"","name":"Time Warner"},{"query":"AT&T","name":"AT&T"}]}}

2009-05-28 14:21:00 is the array and changes all the time, how would I go about creating a class around this?


May 30, 2009 at 1:43 AM

The date is a property name which is tricky.

You could either load the JSON into a JObject and then pull out the JSON below the property manaually or you could write some classes so that bit of JSON (the object referenced by trends) is deserialized into a Dictionary<string, string>.