I’m trying to Parse Json search results from twitter and I am using JArray.
The problem is this, I can parse someones username and the results will display, however, when I try to parse the search API nothing displays. Here is my code:
private void twitterClient()
{
WebClient wc = new WebClient();
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted);
wc.DownloadStringAsync(new Uri("http://search.twitter.com/search.json?q=twitter&rpp=5&include_entities=true&result_type=mixed"));
}
void DownloadStringCompleted(object senders, DownloadStringCompletedEventArgs e)
{
try {
JArray twitterContent = JArray.Parse(e.Result);
}catch(Exception twit_error)
{
MessageBox.Show("Cannot parse");
}
}
As you can see, the URL exists, and, if I change the url from search to someones username, it will parse and display these results.
Hope someone can help me or offer some advice.
The JSON returned by the provided URI is not an array, it’s an object. Therefore wouldn’t
be more appropriate?