开发者社区 问答 正文

请问怎么获取json对象中的特定值?

{
    "id": "some",
    "title": "some",
    "author": {
        "name": "\u95eb\u9759"
    },
    "link": [{
        "@attributes": {
            "href": "http://localhost/",
            "rel": "some"
        }
    },
    {
        "@attributes": {
            "href": "http://localhost/",
            "rel": "some"
        }
    },
    {
        "@attributes": {
            "href": "http://localhost/",
            "rel": "some"
        }
    }]
}

如上,对于服务器返回的json数据,如何获取Link中第一个@attributes的href值?

展开
收起
爵霸 2016-03-05 13:22:54 2253 分享 版权
1 条回答
写回答
取消 提交回答
  • var req = { ...你的返回对象... };
    var first_href_val = req.link[0]['@attributes'];
    2019-07-17 18:53:15
    赞同 展开评论
问答分类:
问答标签:
问答地址: