Skip to content

Instantly share code, notes, and snippets.

@vkbandi
Created September 16, 2015 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkbandi/1f4fd41825efacbeeded to your computer and use it in GitHub Desktop.
Save vkbandi/1f4fd41825efacbeeded to your computer and use it in GitHub Desktop.
A simple C# script for showing how to analyze the results from twitter json - code snippet for coderbuddy.wordpress.com
//The following code is a straight copy from jamiedigi.com
HashTable jsonHash = (Hashtable)JSON.JsonDecode(jsonCode);
ArrayList jsonResults = (ArrayList)jsonHash["results"];
foreach (object objResult in jsonResults)
{
Hashtable jsonResult = (Hashtable)objResult;
System.Diagnostics.Debug.WriteLine("User ID: "
+ jsonResult["from_user_id"].ToString());
System.Diagnostics.Debug.WriteLine("Tweet text: "
+ jsonResult["text"].ToString());
System.Diagnostics.Debug.WriteLine("Tweet date: "
+ jsonResult["created_at"].ToString());
System.Diagnostics.Debug.WriteLine("User name: "
+ jsonResult["from_user"].ToString());
System.Diagnostics.Debug.WriteLine("Language: "
+ jsonResult["iso_language_code"].ToString())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment