开发者社区> 问答> 正文

请问怎么获取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 2139 0
1 条回答
写回答
取消 提交回答
  • var req = { ...你的返回对象... };
    var first_href_val = req.link[0]['@attributes'];
    2019-07-17 18:53:15
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载