过滤特定值的 JSON 响应

问题描述 投票:0回答:0

所以我想从 JSON 响应中获取钱包的特定 NFT 集合(顺便说一句,如果有人知道一种方法来只从特定集合中获取拥有的 nft 而不是过滤也可以),我得到它来获取所有 NFT 但是我只希望它显示 1 个特定的集合。我将如何过滤该输出?使用 typescript + react

    async function getNFT() {
        const apiKey = "";
        const baseURL = `https://eth-mainnet.g.alchemy.com/nft/v2/${apiKey}/getNFTs/`;
        const ownerAddr = address;

        var config = {
            method: 'get',
            url: `${baseURL}?owner=${ownerAddr}`
          };

          axios(config)
            .then(response => console.log(JSON.stringify(response.data, null, 2)))
            .catch(error => console.log(error));

    }
      
      getNFT()
reactjs json typescript axios web3js
© www.soinside.com 2019 - 2024. All rights reserved.