我從 api GET 調(diào)用中獲取 JSON。我正在嘗試獲取我認(rèn)為是數(shù)組的項(xiàng)目的值。我正在嘗試控制臺(tái)記錄 json 的低價(jià)。我試圖像 open.openDate.btcusd[5] 之類的數(shù)組一樣循環(huán)遍歷它。//來自API的JSON數(shù)據(jù) btcusd":{ "high":"9206.36", "low":"8804.57", "volume":"1291.122483", "last":"8989.64", "bid":"8987.88", "ask":"8998.24"//稱呼 coin.getOpen() .then(data=>{ coin.ui(data); });//功能 async getOpen(){ const openres = await fetch(`https://api.lakebtc.com/api_v2/ticker`); const openBtc = await openres.json(); return { openDate : openBtc } }//新函數(shù)到console.log ui(open){ console.log(open.openDate.btcusd); //I want the low value }
如何獲取項(xiàng)目值json
繁星點(diǎn)點(diǎn)滴滴
2021-06-16 17:10:35