通过JSON解析计算用户的总转发 [英] calculating total retweets TO a user by JSON Parsing

查看:423
本文介绍了通过JSON解析计算用户的总转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算C#中的转发总数,我的想法是计算JSON响应中的 retweeted_status 字段。我使用JSON.NET.Is有任何较短方式来计算呢?
其他方法是创建类和填充响应和迭代的对象。但我正在寻找一个更短的方法,因为它只是一个简单的计数。
任何可以帮助我的人,
这是JSON响应

I am calculating total number of retweets in C#,My Idea is to calulate the retweeted_status field in the JSON response.I am using JSON.NET.Is there any shorter way to calculate it? Other way would be to create the classes and populate the Response and iterate theough the object.But I am looking for a shorter way because Its just a simple count. Any one who can help me, This is JSON response

推荐答案

是的,您可以使用 json 解析为动态 Json.Net

Yes, you do this by deserilaize the json into a dynamic object using Json.Net.

dynamic values = JsonConvert.DeserializeObject<dynamic>(json);

并将值转换为 Dictionary< string,object>

IDictionary<string, object> list = (IDictionary<string, object>)values;

这篇关于通过JSON解析计算用户的总转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆