-3

通过这段代码,我尝试读取 summary-> unseen_count 的值,但我不能

FacebookClient fb = new FacebookClient(Settings.Default["token"].ToString());

        try
        {
            dynamic FriendList = fb.Get("/me/notifications");

            int count = (int)FriendList.data.Count;

            for (int i = 0; i < count; i++)
            {
                textBox1.Text = FriendList.data[i].summary.unseen_count;
            }
        }
        catch
        {

        }

返回json数据:

{
       "data": [
          {
             "id": "notif_1000XXXX",    
              "etc"...         
          }
       ],
       "paging": {},

       "summary": {
          "unseen_count": 2,
          "updated_time": "2013-05-22T18:39:00+0000"
       }
    }

你能帮我吗?我从来不明白它是如何工作的 json

4

1 回答 1

2

看起来 summary 不是数据的子节点;您是否尝试过以下(在 for 循环之外)?

textBox1.Text = FriendList.summary.unseen_count;
于 2013-05-22T19:52:17.493 回答