Skip to content

Create JSON metadata files from a CSV with traits using a Python script

License

Notifications You must be signed in to change notification settings

alxrnz2/CSV-to-JSON-via-Python-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Create JSONs from a CSV file using a Python script

Overview

Our Compiler.py python script converts the traits in Roster.csv into a JSON file for each row.

While this logic can be used for a number of applications, our example creates JSONs for an NFT collection called ParkPics. Find the full repo for ParkPics here, which covers metadata pinning/upload, smart contracts, deployment, verification, and OpenSea import.

Steps to update Compiler.py

First, adjust the image pin to reflect your images' CAR file. Learn more about CARs in our ERC 1155 repo.

archive = "ipfs://bafybeiatmiig6ylhha5p7o7bxvqutfitv6k2n5ghche4r22tgkmoz6gu5u/"

Next, update the Compiler.py variables for your metadata fields and number of rows. For debugging purposes, we use descriptive labels for each variable.

filename = row[0]
name = row[1]
park = row[2]
type = row[3]
feature = row[4]

Finally, update NFTjson = ... for the desired fields in your JSONs. Learn more from the NFT School about token metadata standards.

Create your JSONs

Run the Compiler.py script in your IDE/CLI of choice. If you're new to Python scripts, check out this Python tutorial from VS Code.

Test the JSONs before upload

Before uploading your JSONs, we recommend opening a few in VS Code (or a similar IDE), right clicking anywhere in the JSON, and selecting Format Document. Then, the IDE should flag any formatting errors that you'd need to fix in your Python script.

About

Create JSON metadata files from a CSV with traits using a Python script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages