在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/網(wǎng)絡安全  HTML/ 循環(huán)遍歷請求返回的json數(shù)據(jù)

循環(huán)遍歷請求返回的json數(shù)據(jù)

"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": "頁數(shù)",
                        "location": "query",
                        "type": "varchar",
                        "requires": "1"
                    },
                    {
                        "default": "",
                        "name": "limit",
                        "description": "每頁顯示數(shù)量",
                        "location": "query",
                        "type": "varchar",
                        "requires": "1"
                    }
                ],
                "outputList": [
                    {
                        "name": "QYHCCSJYX",
                        "description": "遷移或拆除省級以下(含省級)文物保護單位審批文件"
                    }
                ]
            }
        ]

上述是請求返回的數(shù)據(jù)格式,如何遍歷獲取inputList、outputList數(shù)組?

回答
編輯回答
焚音

不是很明白你的意思, 問題描述的不清晰

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

如果 apiList.length > 1 那么也就是加個循環(huán)

let inputLists = []
apiList.forEach((item, index) => {
    inputList.push(item.inputList)
})
2017年6月14日 18:48