Generate NFT Metadata (JSON) using Python - Much Exclusive Doge Yacht Club Collection - Part IV
Tags: nft, python, tutorial, vscode
Published: 2022-04-30 19:55:59

In the last tutorial, we generated our NFT collection by using a Python library.

We will pick up from there and generate the respective metadata for the NFT collection by using our Python library once again.

The first thing we want to do is locate the **images** folder that contains our NFTs. 

Right click on the images folder in Visual Studio Code and click on **Reveal in Finder** to see where the folder is located.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/earxop11j917ghpo8o59.png)

Have this folder at hand, we will come back to it.

In the meantime, go to [Pinata](https://app.pinata.cloud/register) and create an account. 

Pinata is the service that will use to host our NFT data.

After creating an account, login with you credentials.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i83fmxi31v03ehjw4yod.png)
 
On the Pinata dashboard, go to **Upload** > **Folder**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpj2wpnpomxcxrwdikaj.png)

Click on **Select** and upload the images folder that we located earlier on.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omx5uji0fz4a5cmy2odq.png)

Give a name to the folder and click **Upload**. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5fbf1y3mbzqb2lqk4e7.png)
 
The folder will appear on your dashboard once the upload is complete.

Copy the **CID** for the folder.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rff3r94bljngo7u5dcuq.png)
 
Open Visual Studio Code and go to the **metadata.py** file.

Locate lines 16 - 25 in the **metadata.py** file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kx58527vhjgumacwgt7a.png)

In line 17, paste the **CID** that you copied from Pinata. Make sure you pasted the **CID** correctly. It must go after the double forward slashes ( // ).

In line 18, choose a display name for the NFTs. In my case, I chose "Doge #", so when I generate the metadata, I will get something like "Doge #1" for the first NFT. "Doge #2" for the second one and so for and so on. 

In line 22, add a description for your collection. It can be anything. Tell others about your collection.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e1z3wcgkwbmqc8o775qw.png)
 
Save the **metadata.py** file.

Open a terminal, make sure you are in the **generative-art-nft** folder, and run the following command.  

```
python metadata.py
```
You will be prompted to enter the name of your edition.

```
Enter edition you want to generate metadata for: 
Much Wow Doge Club
```

Enter the name of you NFT collection and press enter.

The command above will generate the respective JSON data for the NFT collection.

You will see a new folder on the left side of Visual Studio Code named **json** with the metadata for each NFT.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd78qtmacx9cn8y6sfy2.png) 

Feel free to explore the files in the **json** folder. These files are a description of each NFT. They contain the name of each NFT and its properties. 

However, you might notice that the files in the **json** folder don't have the **.json** extension. This seems to be a problem with the library itself.

What you can do is open the **json** folder and add the **.json** extension to all the files manually.

You can do this by selecting all files and renaming them in batch. You can do this on Mac and Windows. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pymywe7xb9pj3a4h1253.png)

After adding the **.json** extension to the files, you should see them show up with the right extension on the left side of Visual Studio Code.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfvwk0ymlyijswyhq6iu.png)

Finally, go to Pinata again and upload the **json** folder in the same way that we did with the **images** folder in the beginning of this tutorial.

In the end, your Pinata dashboard should have two folders; one for the images and one for the json files.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68fl9l3vpiaxqvqjp6lt.png)
 
In the next tutorial, we will need the CID of the json folder, so keep that in mind.

This is where we end this tutorial, but in the next one, we will be deploying our NFT collection on OpenSea.

If you can't wait to finish this series, you can check out the entire NFT video series which is already out on Youtube. 

Don't forget to [subscribe](https://www.youtube.com/channel/UChZR16e1XwZXy2yrk_8ymFg/?sub_confirmation=1)!! :)

**Youtube:**

{% youtube 2J2trMV-2MI%}

**Twitter:**

[balt1794](https://twitter.com/balt1794)

**OpenSea**

[MEDYC Collection](https://opensea.io/collection/much-exclusive-doge-yacht-club)