为了账号安全,请及时绑定邮箱和手机立即绑定

循环遍历请求返回的json数据

循环遍历请求返回的json数据

开心每一天1111 2019-03-04 08:11:53
"apiList: [            {`请输入代码`                "method": "GET",                "version": "1",                "authtype": "apikey",                "resulttype": "json",                "inputList": [                    {                        "default": "",                        "name": "ApiKey",                        "description": "ApiKey",                        "location": "header",                        "type": "varchar",                        "requires": "1"                    },                    {                        "default": "",                        "name": "page",                        "description": "页数",                        "location": "query",                        "type": "varchar",                        "requires": "1"                    },                    {                        "default": "",                        "name": "limit",                        "description": "每页显示数量",                        "location": "query",                        "type": "varchar",                        "requires": "1"                    }                ],                "outputList": [                    {                        "name": "QYHCCSJYX",                        "description": "迁移或拆除省级以下(含省级)文物保护单位审批文件"                    }                ]            }        ]上述是请求返回的数据格式,如何遍历获取inputList、outputList数组?
查看完整描述

1 回答

?
牛魔王的故事

TA贡献1830条经验 获得超3个赞

不是很明白你的意思, 问题描述的不清晰


如果 apiList.length === 1, 那么 inputList = apiList[0]['inputList'];

如果 apiList.length > 1 那么也就是加个循环


let inputLists = []

apiList.forEach((item, index) => {

    inputList.push(item.inputList)

})


查看完整回答
反对 回复 2019-03-25
  • 1 回答
  • 0 关注
  • 337 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号