JSON.Net 解析所有消息的 Facebook Graph JSON

JSON.Net parse Facebook Graph JSON for all messages

使用 JSON.Net (http://www.newtonsoft.com/json/help/html/LINQtoJSON.htm) 和以下代码:

@using Newtonsoft.Json;
@using Newtonsoft.Json.Linq;


@{

    var url = "https://graph.facebook.com/v2.2/me&fields=id%2Cname%2Cposts.limit(3)&format=json&method=get&pretty=0&suppress_http_code=1";
    var syncClient = new WebClient();
    var content = syncClient.DownloadString(url);

    JObject facebook = JObject.Parse(content);

    //To-Do: Get all messages as list<string> using LINQ for JSON
    // Ex:  IList<string> allDrives = o["Drives"].Select(t => (string)t).ToList();




}

如果采用以下 JSON 格式 (http://www.codeshare.io/EvIdN),我将如何获得所有消息的列表<>。

提前致谢!

选择所有消息作为字符串(不检查错误):

var arr = ((JArray) obj["posts"]["data"]).Select(e => (string) ((JValue) e["message"]).Value).ToList();