0

我查阅了很多参考资料。但我不知道如何用嵌套数组解析 json 数据。

{
"data": [{
    "location": {
        "id": "833",
        "latitude": 37.77956816727314,
        "longitude": -122.41387367248539,
        "name": "Civic Center BART"
    },
"likes": {
        "count": 190,
        "data": [{
            "username": "shayne",
            "full_name": "Shayne Sweeney",
            "id": "20",
            "profile_picture": "..."
        }, {...subset of likers...}]
    },

使用 JObject 我可以解析数据。但是使用 for 循环获取“like”内部的数据对象的值是行不通的。

var newsfeeds = from f in jsonObject["data"].Children()
                            select new Feeds
                            {
                                Name = (string)f["name"],
                                ID = (string)f["id"],
                                Link = (string)f["link"],
                                Message = (string)f["story"],
                                Picture = (string)f["picture"],
                                Created_time = (string)f["created_time"],
                                likes =  ?
                                };

这是问号中出现的问题。likes 是一个喜欢对象的列表。提前致谢。

4

0 回答 0