如何在C#中检索此数据? [英] How do I retrieve this data in C#?
问题描述
我抓了一个我从Instagram api收到的json文件看起来像这样
http://pastebin.com/7GMcQGew
然后我用了json2csharp并创建了这些类
http://pastebin.com/bbDHgLUu
据说我可以得到一些数据的值,例如meta,通过这样做返回值200
WebClient webClient = new WebClient();
var list = webClient.DownloadString(https://api.instagram.com/v1/tags/likeforlike/media/recent?access_token=+ Variables.authtoken +& count = 5);
var parsedList = JsonConvert.DeserializeObject< rootobject>(list);
MessageBox.Show(parsedList.meta.code.ToString ());
但如果我试过
MessageBox.Show(parsedList.data.comments。 ToString());
或
MessageBox.Show (parsedList.user.id.ToString());
我只收到错误。我是c#的新手,我不确定如何获得我需要的数据。 Meta使用200返回正常但没有其他工作。
I grabbed a json file I received from the instagram api it looked like this
http://pastebin.com/7GMcQGew
then I used json2csharp and created these classes
http://pastebin.com/bbDHgLUu
with that being said I can get the values of some data such as "meta" which returns the value 200 by doing this
WebClient webClient = new WebClient();
var list = webClient.DownloadString("https://api.instagram.com/v1/tags/likeforlike/media/recent?access_token=" + Variables.authtoken + "&count=5");
var parsedList = JsonConvert.DeserializeObject<rootobject>(list);
MessageBox.Show(parsedList.meta.code.ToString());
but if I tried
MessageBox.Show(parsedList.data.comments.ToString());
or
MessageBox.Show(parsedList.user.id.ToString());
I only get errors. I'm new to c# and i'm not sure how I would get the data I need. Meta returns fine with "200" but nothing else works.
推荐答案
这篇关于如何在C#中检索此数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!