I canât find the reason of the error and proceed to the next step of https://www.youtube.com/watch?v=tBMk1iZa85Y.
unction fetchNFTMetadata(NFTs){
let promises = [];
for (let i =0; i < NFTs.length; i++) {
let nft = NFTs[i];
let id = nft.token_id;
//Call Moralis Cloud function -> static JSON File
promises.push(fetch("https://XXXXXXX.usemoralis.com:2053/server/functions/getNFT?_ApplicationId=XXXXXXXXXXXXX&nftId="+ id)
.then(res => res.json())
.then(res => JSON.parse(res.result))
.then(res => {nft.metadata = res})
.then( () => {return nft;}))
}
return Promise.all(promises);
}
I saw the error message below
Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
fetchNFTMetadata http://127.0.0.1:5501/main.js:14
promise callbackfetchNFTMetadata http://127.0.0.1:5501/main.js:14
initializeApp http://127.0.0.1:5501/main.js:54
async http://127.0.0.1:5501/main.js:60
main.js:14:27
When I remove " .then(res => JSON.parse(res.result))", I could see the result with âundefinedâ
What is the reason of error? I canât proceed it any more for a week!