用c#解析twitter搜索api的JSON响应

时间:2016-03-24 07:42:28

标签: c# json twitter

我无法理解从twitter搜索API解析JSon响应的错误。在Visual Studio的调试模式下,我看到了JSON格式的推文,但我无法获得它们的值。 这是我的代码:

var requestUserTimeline = new HttpRequestMessage(HttpMethod.Get, string.Format("https://api.twitter.com/1.1/search/tweets.json?q=%23moscow"));
requestUserTimeline.Headers.Add("Authorization", "Bearer " + accessToken);
var httpClient = new HttpClient();
HttpResponseMessage responseUserTimeLine = await httpClient.SendAsync(requestUserTimeline);

dynamic json = JsonConvert.DeserializeObject<object>(await responseUserTimeLine.Content.ReadAsStringAsync());
foreach(var item in json)
{
      Console.WriteLine(item.statuses.text);
}

感谢您的帮助

0 个答案:

没有答案