Here is the code:
When I use
let metadata = allNFTs.map((e) => JSON.parse(e.metadata).attributes);
in the code I got
"TypeError: Cannot read properties of null (reading 'attributes')"
but If I use
let metadata = allNFTs.map((e) => JSON.parse(e.metadata));
I got this metadata ;
{
name: 'Bro #1999',
dna: 'edff418af9ddb532061ffd41317244b5bdecae65',
external_url: 'https://avaxbros.com',
description: '1 of 2000 randomly generated and unique characters in the AVAX Bros collection.',
image: 'https://ipfs.io/ipfs/QmbQsNzqevJrMFHR9xy8wk2Q7gYPppD3RsVwXmUo4asP9s',
edition: 1999,
attributes: [
{ trait_type: 'Background', value: "Green 'C'" },
{ trait_type: 'Body', value: "Red 'C'" },
{ trait_type: 'Eyes', value: "Sleepy 'C'" },
{ trait_type: 'Hat', value: "Explorer 'R'" },
{ trait_type: 'Mouth', value: "Tongue Out 'U'" },
{ trait_type: 'Neck', value: "None 'C'" }
]
}
I need to get attributes to use the data. How can I fix this ?
Thank you allready.