I ended up using Json.NET , which in addition to being OpenSource is also one of the most robust utilities which makes working with JSON formatted data dead simple.
The code for the console app is quite straightforward. The static function ReadTrends() retrieves the JSON string from twitter which is then consumed and extracted. The only tricky part was using a constant key; the easiest way I could think of doing this was to replace the date-time stamp with a literal and then use that literal.
Of course this will fail if you the function ReadTrends() is called at (or just before midnight) on Dec 31st and the code returns to the main() function in the new year. I don’t think this is something I am going to put in production and am not going to be too worried about this behaviour.
At the time of writing this, the twitter trends (in JSON) are:
And here is the output in the console. I can see Charlie Sheen’s #tigerblood is still trending; and wonder what Artic Monkeys are upto – is there new album out or something?
All done. Press any key to continue...
And finally here is the code.